chore(quarkus-327): bump to Quarkus 3.27.3 LTS, rename deprecated config keys
Some checks failed
CI/CD Pipeline / pipeline (push) Failing after 4m9s
Some checks failed
CI/CD Pipeline / pipeline (push) Failing after 4m9s
This commit is contained in:
18
.gitignore
vendored
18
.gitignore
vendored
@@ -74,3 +74,21 @@ env.production.local
|
||||
backend-secret.txt
|
||||
keycloak-secret.txt
|
||||
db-password.txt
|
||||
*.jks
|
||||
*.p12
|
||||
*.keystore
|
||||
application-local.properties
|
||||
application-dev-override.properties
|
||||
|
||||
# Database files (dev/test)
|
||||
*.db
|
||||
*.sqlite
|
||||
*.h2.db
|
||||
|
||||
# Docker
|
||||
docker-compose.override.yml
|
||||
|
||||
# Eclipse specific
|
||||
bin/
|
||||
.apt_generated/
|
||||
.metadata/
|
||||
|
||||
@@ -1,238 +1,238 @@
|
||||
# 📋 STANDARDISATION API - BTPXPRESS
|
||||
|
||||
**Date** : 2025-01-30
|
||||
**Version** : 1.0
|
||||
**Objectif** : Standardiser tous les endpoints REST avec format uniforme
|
||||
|
||||
---
|
||||
|
||||
## ✅ CE QUI A ÉTÉ FAIT
|
||||
|
||||
### 1. Classes de base créées
|
||||
|
||||
✅ **ApiResponse<T>** - Wrapper pour réponses uniformes
|
||||
- Format standard avec `data`, `success`, `message`, `timestamp`
|
||||
- Méthodes factory pour succès et erreurs
|
||||
- Support des codes d'erreur et détails
|
||||
|
||||
✅ **PagedResponse<T>** - Wrapper pour réponses paginées
|
||||
- Format avec `data`, `pagination`, `success`, `timestamp`
|
||||
- Métadonnées : `page`, `size`, `total`, `totalPages`, `hasNext`, `hasPrevious`
|
||||
|
||||
✅ **ResponseHelper** - Classe utilitaire
|
||||
- Méthodes statiques pour créer réponses standardisées
|
||||
- Support de tous les codes HTTP courants
|
||||
- Gestion d'erreurs uniforme
|
||||
|
||||
### 2. Resources migrés (37/37) ✅ **COMPLET**
|
||||
|
||||
✅ **ChantierResource** - Complètement migré
|
||||
- Tous les endpoints utilisent `ResponseHelper`
|
||||
- Format uniforme pour succès et erreurs
|
||||
- Messages descriptifs
|
||||
|
||||
✅ **ClientResource** - Complètement migré
|
||||
- Tous les endpoints utilisent `ResponseHelper`
|
||||
- Support pagination avec `PagedResponse`
|
||||
- Format uniforme
|
||||
|
||||
✅ **DevisResource** - Complètement migré
|
||||
✅ **FactureResource** - Complètement migré
|
||||
✅ **BudgetResource** - Complètement migré
|
||||
✅ **EmployeResource** - Complètement migré
|
||||
✅ **MaterielResource** - Complètement migré
|
||||
✅ **PlanningResource** - Complètement migré
|
||||
✅ **StockResource** - Complètement migré
|
||||
✅ **BonCommandeResource** - Complètement migré
|
||||
✅ **PhaseChantierResource** - Complètement migré
|
||||
✅ **EquipeResource** - Complètement migré
|
||||
✅ **FournisseurResource** - Complètement migré
|
||||
✅ **DisponibiliteResource** - Complètement migré
|
||||
✅ **MaintenanceResource** - Complètement migré
|
||||
✅ **DocumentResource** - Complètement migré
|
||||
✅ **MessageResource** - Complètement migré
|
||||
✅ **NotificationResource** - Complètement migré
|
||||
✅ **ReservationMaterielResource** - Complètement migré
|
||||
✅ **LivraisonMaterielResource** - Complètement migré
|
||||
✅ **PlanningMaterielResource** - Complètement migré
|
||||
✅ **UserResource** - Complètement migré
|
||||
✅ **AbonnementResource** - Complètement migré
|
||||
✅ **EntrepriseProfileResource** - Complètement migré
|
||||
✅ **DashboardResource** - Complètement migré
|
||||
✅ **PhotoResource** - Complètement migré
|
||||
✅ **HealthResource** - Complètement migré
|
||||
✅ **AuthResource** - Complètement migré
|
||||
✅ **TypeChantierResource** - Complètement migré
|
||||
✅ **PermissionResource** - Complètement migré
|
||||
✅ **ZoneClimatiqueResource** - Complètement migré
|
||||
✅ **ComparaisonFournisseurResource** - Complètement migré
|
||||
✅ **PhaseTemplateResource** - Complètement migré
|
||||
✅ **SousPhaseTemplateResource** - Complètement migré
|
||||
✅ **TacheTemplateResource** - Complètement migré
|
||||
✅ **CalculsTechniquesResource** - Complètement migré
|
||||
✅ **ReportResource** - Complètement migré
|
||||
✅ **DashboardResource** - Complètement migré
|
||||
|
||||
---
|
||||
|
||||
## 📐 FORMAT DE RÉPONSE STANDARD
|
||||
|
||||
### Réponse simple (ApiResponse)
|
||||
|
||||
```json
|
||||
{
|
||||
"data": {
|
||||
"id": "uuid",
|
||||
"nom": "...",
|
||||
...
|
||||
},
|
||||
"success": true,
|
||||
"message": "Opération réussie",
|
||||
"timestamp": "2025-01-30T10:00:00"
|
||||
}
|
||||
```
|
||||
|
||||
### Réponse paginée (PagedResponse)
|
||||
|
||||
```json
|
||||
{
|
||||
"data": [...],
|
||||
"pagination": {
|
||||
"page": 0,
|
||||
"size": 20,
|
||||
"total": 100,
|
||||
"totalPages": 5,
|
||||
"hasNext": true,
|
||||
"hasPrevious": false
|
||||
},
|
||||
"success": true,
|
||||
"timestamp": "2025-01-30T10:00:00"
|
||||
}
|
||||
```
|
||||
|
||||
### Réponse d'erreur
|
||||
|
||||
```json
|
||||
{
|
||||
"data": null,
|
||||
"success": false,
|
||||
"errorCode": "BAD_REQUEST",
|
||||
"message": "Données invalides: ...",
|
||||
"errorDetails": {...},
|
||||
"timestamp": "2025-01-30T10:00:00"
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🔧 UTILISATION
|
||||
|
||||
### Exemple : Endpoint GET simple
|
||||
|
||||
```java
|
||||
@GET
|
||||
@Path("/{id}")
|
||||
public Response getById(@PathParam("id") UUID id) {
|
||||
try {
|
||||
Entity entity = service.findByIdRequired(id);
|
||||
EntityDTO dto = mapper.toResponseDTO(entity);
|
||||
return ResponseHelper.ok(dto);
|
||||
} catch (NotFoundException e) {
|
||||
return ResponseHelper.notFound("Entity", id);
|
||||
} catch (Exception e) {
|
||||
logger.error("Erreur", e);
|
||||
return ResponseHelper.internalError("Erreur: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Exemple : Endpoint GET avec pagination
|
||||
|
||||
```java
|
||||
@GET
|
||||
public Response getAll(
|
||||
@QueryParam("page") @DefaultValue("0") int page,
|
||||
@QueryParam("size") @DefaultValue("20") int size) {
|
||||
|
||||
List<Entity> entities = service.findAll(page, size);
|
||||
long total = service.count();
|
||||
|
||||
List<EntityDTO> dtos = entities.stream()
|
||||
.map(mapper::toResponseDTO)
|
||||
.toList();
|
||||
|
||||
return ResponseHelper.paginated(dtos, page, size, total);
|
||||
}
|
||||
```
|
||||
|
||||
### Exemple : Endpoint POST
|
||||
|
||||
```java
|
||||
@POST
|
||||
public Response create(@Valid EntityCreateDTO dto) {
|
||||
try {
|
||||
Entity entity = service.create(dto);
|
||||
EntityDTO responseDTO = mapper.toResponseDTO(entity);
|
||||
return ResponseHelper.created(responseDTO, "Ressource créée avec succès");
|
||||
} catch (IllegalArgumentException e) {
|
||||
return ResponseHelper.badRequest("Données invalides: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Exemple : Endpoint DELETE
|
||||
|
||||
```java
|
||||
@DELETE
|
||||
@Path("/{id}")
|
||||
public Response delete(@PathParam("id") UUID id) {
|
||||
try {
|
||||
service.delete(id);
|
||||
return ResponseHelper.noContent("Ressource supprimée avec succès");
|
||||
} catch (NotFoundException e) {
|
||||
return ResponseHelper.notFound("Entity", id);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## ✅ MIGRATION TERMINÉE - TOUS LES RESOURCES SONT MIGRÉS (37/37)
|
||||
|
||||
### ✅ Tous les Resources migrés
|
||||
- ✅ 37/37 Resources utilisent `ResponseHelper` et DTOs/Mappers
|
||||
- ✅ Format de réponse standardisé
|
||||
- ✅ Pagination implémentée où pertinent
|
||||
- ✅ Gestion d'erreurs uniforme
|
||||
|
||||
### ✅ DTOs et Mappers créés
|
||||
- ✅ 52 DTOs créés (CreateDTO + ResponseDTO pour tous les concepts)
|
||||
- ✅ 24 Mappers créés pour conversion Entity ↔ DTO
|
||||
- ✅ Tous les endpoints utilisent les DTOs
|
||||
|
||||
### ✅ Warnings corrigés
|
||||
- ✅ Imports non utilisés supprimés
|
||||
- ✅ Méthodes BigDecimal deprecated corrigées
|
||||
- ✅ Interfaces Serializable redondantes supprimées
|
||||
- ✅ Variables non utilisées corrigées
|
||||
- ✅ Cases manquants dans switch statements ajoutés
|
||||
- ⚠️ 20 warnings non critiques restants (objets anonymes pour JSON - normal)
|
||||
|
||||
### ✅ TODOs corrigés
|
||||
- ✅ TODO ChantiersView : clientId récupéré depuis les données API
|
||||
- ✅ TODO ClientResource : commentaire d'optimisation ajouté
|
||||
|
||||
---
|
||||
|
||||
## 🎯 PROCHAINES ÉTAPES (Optionnel)
|
||||
|
||||
1. **Compléter OpenAPI** avec exemples détaillés
|
||||
2. **Ajouter paramètres de tri standardisés** : `sort`, `direction`
|
||||
3. **Réactiver les tests** (bug Quarkus connu)
|
||||
4. **Améliorer documentation** utilisateur
|
||||
|
||||
---
|
||||
|
||||
**Dernière mise à jour** : 2025-01-30
|
||||
**Statut** : ✅ **PROJET TERMINÉ - PRÊT POUR PRODUCTION**
|
||||
|
||||
# 📋 STANDARDISATION API - BTPXPRESS
|
||||
|
||||
**Date** : 2025-01-30
|
||||
**Version** : 1.0
|
||||
**Objectif** : Standardiser tous les endpoints REST avec format uniforme
|
||||
|
||||
---
|
||||
|
||||
## ✅ CE QUI A ÉTÉ FAIT
|
||||
|
||||
### 1. Classes de base créées
|
||||
|
||||
✅ **ApiResponse<T>** - Wrapper pour réponses uniformes
|
||||
- Format standard avec `data`, `success`, `message`, `timestamp`
|
||||
- Méthodes factory pour succès et erreurs
|
||||
- Support des codes d'erreur et détails
|
||||
|
||||
✅ **PagedResponse<T>** - Wrapper pour réponses paginées
|
||||
- Format avec `data`, `pagination`, `success`, `timestamp`
|
||||
- Métadonnées : `page`, `size`, `total`, `totalPages`, `hasNext`, `hasPrevious`
|
||||
|
||||
✅ **ResponseHelper** - Classe utilitaire
|
||||
- Méthodes statiques pour créer réponses standardisées
|
||||
- Support de tous les codes HTTP courants
|
||||
- Gestion d'erreurs uniforme
|
||||
|
||||
### 2. Resources migrés (37/37) ✅ **COMPLET**
|
||||
|
||||
✅ **ChantierResource** - Complètement migré
|
||||
- Tous les endpoints utilisent `ResponseHelper`
|
||||
- Format uniforme pour succès et erreurs
|
||||
- Messages descriptifs
|
||||
|
||||
✅ **ClientResource** - Complètement migré
|
||||
- Tous les endpoints utilisent `ResponseHelper`
|
||||
- Support pagination avec `PagedResponse`
|
||||
- Format uniforme
|
||||
|
||||
✅ **DevisResource** - Complètement migré
|
||||
✅ **FactureResource** - Complètement migré
|
||||
✅ **BudgetResource** - Complètement migré
|
||||
✅ **EmployeResource** - Complètement migré
|
||||
✅ **MaterielResource** - Complètement migré
|
||||
✅ **PlanningResource** - Complètement migré
|
||||
✅ **StockResource** - Complètement migré
|
||||
✅ **BonCommandeResource** - Complètement migré
|
||||
✅ **PhaseChantierResource** - Complètement migré
|
||||
✅ **EquipeResource** - Complètement migré
|
||||
✅ **FournisseurResource** - Complètement migré
|
||||
✅ **DisponibiliteResource** - Complètement migré
|
||||
✅ **MaintenanceResource** - Complètement migré
|
||||
✅ **DocumentResource** - Complètement migré
|
||||
✅ **MessageResource** - Complètement migré
|
||||
✅ **NotificationResource** - Complètement migré
|
||||
✅ **ReservationMaterielResource** - Complètement migré
|
||||
✅ **LivraisonMaterielResource** - Complètement migré
|
||||
✅ **PlanningMaterielResource** - Complètement migré
|
||||
✅ **UserResource** - Complètement migré
|
||||
✅ **AbonnementResource** - Complètement migré
|
||||
✅ **EntrepriseProfileResource** - Complètement migré
|
||||
✅ **DashboardResource** - Complètement migré
|
||||
✅ **PhotoResource** - Complètement migré
|
||||
✅ **HealthResource** - Complètement migré
|
||||
✅ **AuthResource** - Complètement migré
|
||||
✅ **TypeChantierResource** - Complètement migré
|
||||
✅ **PermissionResource** - Complètement migré
|
||||
✅ **ZoneClimatiqueResource** - Complètement migré
|
||||
✅ **ComparaisonFournisseurResource** - Complètement migré
|
||||
✅ **PhaseTemplateResource** - Complètement migré
|
||||
✅ **SousPhaseTemplateResource** - Complètement migré
|
||||
✅ **TacheTemplateResource** - Complètement migré
|
||||
✅ **CalculsTechniquesResource** - Complètement migré
|
||||
✅ **ReportResource** - Complètement migré
|
||||
✅ **DashboardResource** - Complètement migré
|
||||
|
||||
---
|
||||
|
||||
## 📐 FORMAT DE RÉPONSE STANDARD
|
||||
|
||||
### Réponse simple (ApiResponse)
|
||||
|
||||
```json
|
||||
{
|
||||
"data": {
|
||||
"id": "uuid",
|
||||
"nom": "...",
|
||||
...
|
||||
},
|
||||
"success": true,
|
||||
"message": "Opération réussie",
|
||||
"timestamp": "2025-01-30T10:00:00"
|
||||
}
|
||||
```
|
||||
|
||||
### Réponse paginée (PagedResponse)
|
||||
|
||||
```json
|
||||
{
|
||||
"data": [...],
|
||||
"pagination": {
|
||||
"page": 0,
|
||||
"size": 20,
|
||||
"total": 100,
|
||||
"totalPages": 5,
|
||||
"hasNext": true,
|
||||
"hasPrevious": false
|
||||
},
|
||||
"success": true,
|
||||
"timestamp": "2025-01-30T10:00:00"
|
||||
}
|
||||
```
|
||||
|
||||
### Réponse d'erreur
|
||||
|
||||
```json
|
||||
{
|
||||
"data": null,
|
||||
"success": false,
|
||||
"errorCode": "BAD_REQUEST",
|
||||
"message": "Données invalides: ...",
|
||||
"errorDetails": {...},
|
||||
"timestamp": "2025-01-30T10:00:00"
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🔧 UTILISATION
|
||||
|
||||
### Exemple : Endpoint GET simple
|
||||
|
||||
```java
|
||||
@GET
|
||||
@Path("/{id}")
|
||||
public Response getById(@PathParam("id") UUID id) {
|
||||
try {
|
||||
Entity entity = service.findByIdRequired(id);
|
||||
EntityDTO dto = mapper.toResponseDTO(entity);
|
||||
return ResponseHelper.ok(dto);
|
||||
} catch (NotFoundException e) {
|
||||
return ResponseHelper.notFound("Entity", id);
|
||||
} catch (Exception e) {
|
||||
logger.error("Erreur", e);
|
||||
return ResponseHelper.internalError("Erreur: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Exemple : Endpoint GET avec pagination
|
||||
|
||||
```java
|
||||
@GET
|
||||
public Response getAll(
|
||||
@QueryParam("page") @DefaultValue("0") int page,
|
||||
@QueryParam("size") @DefaultValue("20") int size) {
|
||||
|
||||
List<Entity> entities = service.findAll(page, size);
|
||||
long total = service.count();
|
||||
|
||||
List<EntityDTO> dtos = entities.stream()
|
||||
.map(mapper::toResponseDTO)
|
||||
.toList();
|
||||
|
||||
return ResponseHelper.paginated(dtos, page, size, total);
|
||||
}
|
||||
```
|
||||
|
||||
### Exemple : Endpoint POST
|
||||
|
||||
```java
|
||||
@POST
|
||||
public Response create(@Valid EntityCreateDTO dto) {
|
||||
try {
|
||||
Entity entity = service.create(dto);
|
||||
EntityDTO responseDTO = mapper.toResponseDTO(entity);
|
||||
return ResponseHelper.created(responseDTO, "Ressource créée avec succès");
|
||||
} catch (IllegalArgumentException e) {
|
||||
return ResponseHelper.badRequest("Données invalides: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Exemple : Endpoint DELETE
|
||||
|
||||
```java
|
||||
@DELETE
|
||||
@Path("/{id}")
|
||||
public Response delete(@PathParam("id") UUID id) {
|
||||
try {
|
||||
service.delete(id);
|
||||
return ResponseHelper.noContent("Ressource supprimée avec succès");
|
||||
} catch (NotFoundException e) {
|
||||
return ResponseHelper.notFound("Entity", id);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## ✅ MIGRATION TERMINÉE - TOUS LES RESOURCES SONT MIGRÉS (37/37)
|
||||
|
||||
### ✅ Tous les Resources migrés
|
||||
- ✅ 37/37 Resources utilisent `ResponseHelper` et DTOs/Mappers
|
||||
- ✅ Format de réponse standardisé
|
||||
- ✅ Pagination implémentée où pertinent
|
||||
- ✅ Gestion d'erreurs uniforme
|
||||
|
||||
### ✅ DTOs et Mappers créés
|
||||
- ✅ 52 DTOs créés (CreateDTO + ResponseDTO pour tous les concepts)
|
||||
- ✅ 24 Mappers créés pour conversion Entity ↔ DTO
|
||||
- ✅ Tous les endpoints utilisent les DTOs
|
||||
|
||||
### ✅ Warnings corrigés
|
||||
- ✅ Imports non utilisés supprimés
|
||||
- ✅ Méthodes BigDecimal deprecated corrigées
|
||||
- ✅ Interfaces Serializable redondantes supprimées
|
||||
- ✅ Variables non utilisées corrigées
|
||||
- ✅ Cases manquants dans switch statements ajoutés
|
||||
- ⚠️ 20 warnings non critiques restants (objets anonymes pour JSON - normal)
|
||||
|
||||
### ✅ TODOs corrigés
|
||||
- ✅ TODO ChantiersView : clientId récupéré depuis les données API
|
||||
- ✅ TODO ClientResource : commentaire d'optimisation ajouté
|
||||
|
||||
---
|
||||
|
||||
## 🎯 PROCHAINES ÉTAPES (Optionnel)
|
||||
|
||||
1. **Compléter OpenAPI** avec exemples détaillés
|
||||
2. **Ajouter paramètres de tri standardisés** : `sort`, `direction`
|
||||
3. **Réactiver les tests** (bug Quarkus connu)
|
||||
4. **Améliorer documentation** utilisateur
|
||||
|
||||
---
|
||||
|
||||
**Dernière mise à jour** : 2025-01-30
|
||||
**Statut** : ✅ **PROJET TERMINÉ - PRÊT POUR PRODUCTION**
|
||||
|
||||
|
||||
@@ -1,169 +1,169 @@
|
||||
package dev.lions.btpxpress.adapter.http.util;
|
||||
|
||||
import dev.lions.btpxpress.domain.shared.dto.ApiResponse;
|
||||
import dev.lions.btpxpress.domain.shared.dto.PagedResponse;
|
||||
import jakarta.ws.rs.core.Response;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Classe utilitaire pour créer des réponses REST standardisées - Architecture 2025
|
||||
*
|
||||
* Simplifie la création de réponses uniformes pour tous les endpoints
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
public class ResponseHelper {
|
||||
|
||||
// === RÉPONSES DE SUCCÈS ===
|
||||
|
||||
/**
|
||||
* Crée une réponse 200 OK avec des données
|
||||
*/
|
||||
public static <T> Response ok(T data) {
|
||||
return Response.ok(ApiResponse.success(data)).build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Crée une réponse 200 OK avec des données et un message
|
||||
*/
|
||||
public static <T> Response ok(T data, String message) {
|
||||
return Response.ok(ApiResponse.success(data, message)).build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Crée une réponse 201 Created avec des données
|
||||
*/
|
||||
public static <T> Response created(T data) {
|
||||
return Response.status(Response.Status.CREATED)
|
||||
.entity(ApiResponse.success(data, "Ressource créée avec succès"))
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Crée une réponse 201 Created avec des données et un message personnalisé
|
||||
*/
|
||||
public static <T> Response created(T data, String message) {
|
||||
return Response.status(Response.Status.CREATED)
|
||||
.entity(ApiResponse.success(data, message))
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Crée une réponse 204 No Content (pour DELETE)
|
||||
*/
|
||||
public static Response noContent() {
|
||||
return Response.noContent().build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Crée une réponse 204 No Content avec un message
|
||||
*/
|
||||
public static Response noContent(String message) {
|
||||
return Response.status(Response.Status.NO_CONTENT)
|
||||
.entity(ApiResponse.success(message))
|
||||
.build();
|
||||
}
|
||||
|
||||
// === RÉPONSES PAGINÉES ===
|
||||
|
||||
/**
|
||||
* Crée une réponse 200 OK paginée
|
||||
*/
|
||||
public static <T> Response paginated(List<T> data, int page, int size, long total) {
|
||||
return Response.ok(PagedResponse.of(data, page, size, total)).build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Crée une réponse 200 OK paginée avec un message
|
||||
*/
|
||||
public static <T> Response paginated(List<T> data, int page, int size, long total, String message) {
|
||||
return Response.ok(PagedResponse.of(data, page, size, total, message)).build();
|
||||
}
|
||||
|
||||
// === RÉPONSES D'ERREUR ===
|
||||
|
||||
/**
|
||||
* Crée une réponse 400 Bad Request
|
||||
*/
|
||||
public static Response badRequest(String message) {
|
||||
return Response.status(Response.Status.BAD_REQUEST)
|
||||
.entity(ApiResponse.error("BAD_REQUEST", message))
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Crée une réponse 400 Bad Request avec détails
|
||||
*/
|
||||
public static Response badRequest(String message, Object details) {
|
||||
return Response.status(Response.Status.BAD_REQUEST)
|
||||
.entity(ApiResponse.error("BAD_REQUEST", message, details))
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Crée une réponse 404 Not Found
|
||||
*/
|
||||
public static Response notFound(String message) {
|
||||
return Response.status(Response.Status.NOT_FOUND)
|
||||
.entity(ApiResponse.error("NOT_FOUND", message))
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Crée une réponse 404 Not Found avec le type de ressource
|
||||
*/
|
||||
public static Response notFound(String resourceType, Object id) {
|
||||
return Response.status(Response.Status.NOT_FOUND)
|
||||
.entity(ApiResponse.error("NOT_FOUND",
|
||||
String.format("%s non trouvé avec l'ID: %s", resourceType, id)))
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Crée une réponse 409 Conflict
|
||||
*/
|
||||
public static Response conflict(String message) {
|
||||
return Response.status(Response.Status.CONFLICT)
|
||||
.entity(ApiResponse.error("CONFLICT", message))
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Crée une réponse 500 Internal Server Error
|
||||
*/
|
||||
public static Response internalError(String message) {
|
||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR)
|
||||
.entity(ApiResponse.error("INTERNAL_ERROR", message))
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Crée une réponse 500 Internal Server Error avec détails (pour logging)
|
||||
*/
|
||||
public static Response internalError(String message, Object details) {
|
||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR)
|
||||
.entity(ApiResponse.error("INTERNAL_ERROR", message, details))
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Crée une réponse d'erreur personnalisée
|
||||
*/
|
||||
public static Response error(Response.Status status, String errorCode, String message) {
|
||||
return Response.status(status)
|
||||
.entity(ApiResponse.error(errorCode, message))
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Crée une réponse d'erreur personnalisée avec détails
|
||||
*/
|
||||
public static Response error(Response.Status status, String errorCode, String message, Object details) {
|
||||
return Response.status(status)
|
||||
.entity(ApiResponse.error(errorCode, message, details))
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.adapter.http.util;
|
||||
|
||||
import dev.lions.btpxpress.domain.shared.dto.ApiResponse;
|
||||
import dev.lions.btpxpress.domain.shared.dto.PagedResponse;
|
||||
import jakarta.ws.rs.core.Response;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Classe utilitaire pour créer des réponses REST standardisées - Architecture 2025
|
||||
*
|
||||
* Simplifie la création de réponses uniformes pour tous les endpoints
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
public class ResponseHelper {
|
||||
|
||||
// === RÉPONSES DE SUCCÈS ===
|
||||
|
||||
/**
|
||||
* Crée une réponse 200 OK avec des données
|
||||
*/
|
||||
public static <T> Response ok(T data) {
|
||||
return Response.ok(ApiResponse.success(data)).build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Crée une réponse 200 OK avec des données et un message
|
||||
*/
|
||||
public static <T> Response ok(T data, String message) {
|
||||
return Response.ok(ApiResponse.success(data, message)).build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Crée une réponse 201 Created avec des données
|
||||
*/
|
||||
public static <T> Response created(T data) {
|
||||
return Response.status(Response.Status.CREATED)
|
||||
.entity(ApiResponse.success(data, "Ressource créée avec succès"))
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Crée une réponse 201 Created avec des données et un message personnalisé
|
||||
*/
|
||||
public static <T> Response created(T data, String message) {
|
||||
return Response.status(Response.Status.CREATED)
|
||||
.entity(ApiResponse.success(data, message))
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Crée une réponse 204 No Content (pour DELETE)
|
||||
*/
|
||||
public static Response noContent() {
|
||||
return Response.noContent().build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Crée une réponse 204 No Content avec un message
|
||||
*/
|
||||
public static Response noContent(String message) {
|
||||
return Response.status(Response.Status.NO_CONTENT)
|
||||
.entity(ApiResponse.success(message))
|
||||
.build();
|
||||
}
|
||||
|
||||
// === RÉPONSES PAGINÉES ===
|
||||
|
||||
/**
|
||||
* Crée une réponse 200 OK paginée
|
||||
*/
|
||||
public static <T> Response paginated(List<T> data, int page, int size, long total) {
|
||||
return Response.ok(PagedResponse.of(data, page, size, total)).build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Crée une réponse 200 OK paginée avec un message
|
||||
*/
|
||||
public static <T> Response paginated(List<T> data, int page, int size, long total, String message) {
|
||||
return Response.ok(PagedResponse.of(data, page, size, total, message)).build();
|
||||
}
|
||||
|
||||
// === RÉPONSES D'ERREUR ===
|
||||
|
||||
/**
|
||||
* Crée une réponse 400 Bad Request
|
||||
*/
|
||||
public static Response badRequest(String message) {
|
||||
return Response.status(Response.Status.BAD_REQUEST)
|
||||
.entity(ApiResponse.error("BAD_REQUEST", message))
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Crée une réponse 400 Bad Request avec détails
|
||||
*/
|
||||
public static Response badRequest(String message, Object details) {
|
||||
return Response.status(Response.Status.BAD_REQUEST)
|
||||
.entity(ApiResponse.error("BAD_REQUEST", message, details))
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Crée une réponse 404 Not Found
|
||||
*/
|
||||
public static Response notFound(String message) {
|
||||
return Response.status(Response.Status.NOT_FOUND)
|
||||
.entity(ApiResponse.error("NOT_FOUND", message))
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Crée une réponse 404 Not Found avec le type de ressource
|
||||
*/
|
||||
public static Response notFound(String resourceType, Object id) {
|
||||
return Response.status(Response.Status.NOT_FOUND)
|
||||
.entity(ApiResponse.error("NOT_FOUND",
|
||||
String.format("%s non trouvé avec l'ID: %s", resourceType, id)))
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Crée une réponse 409 Conflict
|
||||
*/
|
||||
public static Response conflict(String message) {
|
||||
return Response.status(Response.Status.CONFLICT)
|
||||
.entity(ApiResponse.error("CONFLICT", message))
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Crée une réponse 500 Internal Server Error
|
||||
*/
|
||||
public static Response internalError(String message) {
|
||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR)
|
||||
.entity(ApiResponse.error("INTERNAL_ERROR", message))
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Crée une réponse 500 Internal Server Error avec détails (pour logging)
|
||||
*/
|
||||
public static Response internalError(String message, Object details) {
|
||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR)
|
||||
.entity(ApiResponse.error("INTERNAL_ERROR", message, details))
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Crée une réponse d'erreur personnalisée
|
||||
*/
|
||||
public static Response error(Response.Status status, String errorCode, String message) {
|
||||
return Response.status(status)
|
||||
.entity(ApiResponse.error(errorCode, message))
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Crée une réponse d'erreur personnalisée avec détails
|
||||
*/
|
||||
public static Response error(Response.Status status, String errorCode, String message, Object details) {
|
||||
return Response.status(status)
|
||||
.entity(ApiResponse.error(errorCode, message, details))
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,58 +1,58 @@
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.StatutAbonnement;
|
||||
import dev.lions.btpxpress.domain.core.entity.TypeAbonnement;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la création d'un abonnement - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class AbonnementCreateDTO {
|
||||
|
||||
@NotNull(message = "L'entreprise est obligatoire")
|
||||
private UUID entrepriseId;
|
||||
|
||||
@NotNull(message = "Le type d'abonnement est obligatoire")
|
||||
private TypeAbonnement typeAbonnement;
|
||||
|
||||
private StatutAbonnement statut;
|
||||
|
||||
@NotNull(message = "La date de début est obligatoire")
|
||||
private LocalDate dateDebut;
|
||||
|
||||
@NotNull(message = "La date de fin est obligatoire")
|
||||
private LocalDate dateFin;
|
||||
|
||||
@NotNull(message = "Le prix payé est obligatoire")
|
||||
private BigDecimal prixPaye;
|
||||
|
||||
private String methodePaiement;
|
||||
|
||||
private Boolean autoRenouvellement;
|
||||
|
||||
private String referencePaiement;
|
||||
|
||||
private LocalDate dateDerniereFacture;
|
||||
|
||||
private LocalDate dateProchainPrelevement;
|
||||
|
||||
private Integer misesEnRelationUtilisees;
|
||||
|
||||
private String notes;
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.StatutAbonnement;
|
||||
import dev.lions.btpxpress.domain.core.entity.TypeAbonnement;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la création d'un abonnement - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class AbonnementCreateDTO {
|
||||
|
||||
@NotNull(message = "L'entreprise est obligatoire")
|
||||
private UUID entrepriseId;
|
||||
|
||||
@NotNull(message = "Le type d'abonnement est obligatoire")
|
||||
private TypeAbonnement typeAbonnement;
|
||||
|
||||
private StatutAbonnement statut;
|
||||
|
||||
@NotNull(message = "La date de début est obligatoire")
|
||||
private LocalDate dateDebut;
|
||||
|
||||
@NotNull(message = "La date de fin est obligatoire")
|
||||
private LocalDate dateFin;
|
||||
|
||||
@NotNull(message = "Le prix payé est obligatoire")
|
||||
private BigDecimal prixPaye;
|
||||
|
||||
private String methodePaiement;
|
||||
|
||||
private Boolean autoRenouvellement;
|
||||
|
||||
private String referencePaiement;
|
||||
|
||||
private LocalDate dateDerniereFacture;
|
||||
|
||||
private LocalDate dateProchainPrelevement;
|
||||
|
||||
private Integer misesEnRelationUtilisees;
|
||||
|
||||
private String notes;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,72 +1,72 @@
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.StatutAbonnement;
|
||||
import dev.lions.btpxpress.domain.core.entity.TypeAbonnement;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la réponse d'un abonnement - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class AbonnementResponseDTO {
|
||||
|
||||
private UUID id;
|
||||
|
||||
private TypeAbonnement typeAbonnement;
|
||||
|
||||
private StatutAbonnement statut;
|
||||
|
||||
private LocalDate dateDebut;
|
||||
|
||||
private LocalDate dateFin;
|
||||
|
||||
private BigDecimal prixPaye;
|
||||
|
||||
private String methodePaiement;
|
||||
|
||||
private Boolean autoRenouvellement;
|
||||
|
||||
private String referencePaiement;
|
||||
|
||||
private LocalDate dateDerniereFacture;
|
||||
|
||||
private LocalDate dateProchainPrelevement;
|
||||
|
||||
private Integer misesEnRelationUtilisees;
|
||||
|
||||
private LocalDateTime dateCreation;
|
||||
|
||||
private LocalDateTime dateModification;
|
||||
|
||||
private String notes;
|
||||
|
||||
// Relations simplifiées
|
||||
private UUID entrepriseId;
|
||||
private String entrepriseNomCommercial;
|
||||
|
||||
// Métadonnées calculées
|
||||
private Boolean estActif;
|
||||
|
||||
private Boolean estExpire;
|
||||
|
||||
private Boolean bientotExpire;
|
||||
|
||||
private Long joursRestants;
|
||||
|
||||
private Boolean limiteMisesEnRelationAtteinte;
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.StatutAbonnement;
|
||||
import dev.lions.btpxpress.domain.core.entity.TypeAbonnement;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la réponse d'un abonnement - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class AbonnementResponseDTO {
|
||||
|
||||
private UUID id;
|
||||
|
||||
private TypeAbonnement typeAbonnement;
|
||||
|
||||
private StatutAbonnement statut;
|
||||
|
||||
private LocalDate dateDebut;
|
||||
|
||||
private LocalDate dateFin;
|
||||
|
||||
private BigDecimal prixPaye;
|
||||
|
||||
private String methodePaiement;
|
||||
|
||||
private Boolean autoRenouvellement;
|
||||
|
||||
private String referencePaiement;
|
||||
|
||||
private LocalDate dateDerniereFacture;
|
||||
|
||||
private LocalDate dateProchainPrelevement;
|
||||
|
||||
private Integer misesEnRelationUtilisees;
|
||||
|
||||
private LocalDateTime dateCreation;
|
||||
|
||||
private LocalDateTime dateModification;
|
||||
|
||||
private String notes;
|
||||
|
||||
// Relations simplifiées
|
||||
private UUID entrepriseId;
|
||||
private String entrepriseNomCommercial;
|
||||
|
||||
// Métadonnées calculées
|
||||
private Boolean estActif;
|
||||
|
||||
private Boolean estExpire;
|
||||
|
||||
private Boolean bientotExpire;
|
||||
|
||||
private Long joursRestants;
|
||||
|
||||
private Boolean limiteMisesEnRelationAtteinte;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,138 +1,138 @@
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* Wrapper standard pour toutes les réponses API - Architecture 2025
|
||||
*
|
||||
* Format uniforme pour toutes les réponses REST :
|
||||
* {
|
||||
* "data": {...},
|
||||
* "success": true,
|
||||
* "message": "...",
|
||||
* "timestamp": "2025-01-30T10:00:00"
|
||||
* }
|
||||
*
|
||||
* @param <T> Le type de données retournées
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class ApiResponse<T> {
|
||||
|
||||
/**
|
||||
* Les données retournées (peut être null en cas d'erreur)
|
||||
*/
|
||||
private T data;
|
||||
|
||||
/**
|
||||
* Indique si l'opération a réussi
|
||||
*/
|
||||
@Builder.Default
|
||||
private Boolean success = true;
|
||||
|
||||
/**
|
||||
* Message descriptif (optionnel, souvent utilisé pour les erreurs)
|
||||
*/
|
||||
private String message;
|
||||
|
||||
/**
|
||||
* Timestamp de la réponse
|
||||
*/
|
||||
@Builder.Default
|
||||
private LocalDateTime timestamp = LocalDateTime.now();
|
||||
|
||||
/**
|
||||
* Code d'erreur (optionnel, utilisé uniquement en cas d'erreur)
|
||||
*/
|
||||
private String errorCode;
|
||||
|
||||
/**
|
||||
* Détails de l'erreur (optionnel, utilisé uniquement en cas d'erreur)
|
||||
*/
|
||||
private Object errorDetails;
|
||||
|
||||
// === MÉTHODES STATIQUES DE FACTORY ===
|
||||
|
||||
/**
|
||||
* Crée une réponse de succès avec des données
|
||||
*/
|
||||
public static <T> ApiResponse<T> success(T data) {
|
||||
return ApiResponse.<T>builder()
|
||||
.data(data)
|
||||
.success(true)
|
||||
.timestamp(LocalDateTime.now())
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Crée une réponse de succès avec des données et un message
|
||||
*/
|
||||
public static <T> ApiResponse<T> success(T data, String message) {
|
||||
return ApiResponse.<T>builder()
|
||||
.data(data)
|
||||
.success(true)
|
||||
.message(message)
|
||||
.timestamp(LocalDateTime.now())
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Crée une réponse de succès sans données (pour DELETE, etc.)
|
||||
*/
|
||||
public static <T> ApiResponse<T> success(String message) {
|
||||
return ApiResponse.<T>builder()
|
||||
.success(true)
|
||||
.message(message)
|
||||
.timestamp(LocalDateTime.now())
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Crée une réponse d'erreur
|
||||
*/
|
||||
public static <T> ApiResponse<T> error(String message) {
|
||||
return ApiResponse.<T>builder()
|
||||
.success(false)
|
||||
.message(message)
|
||||
.timestamp(LocalDateTime.now())
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Crée une réponse d'erreur avec code
|
||||
*/
|
||||
public static <T> ApiResponse<T> error(String errorCode, String message) {
|
||||
return ApiResponse.<T>builder()
|
||||
.success(false)
|
||||
.errorCode(errorCode)
|
||||
.message(message)
|
||||
.timestamp(LocalDateTime.now())
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Crée une réponse d'erreur avec code et détails
|
||||
*/
|
||||
public static <T> ApiResponse<T> error(String errorCode, String message, Object errorDetails) {
|
||||
return ApiResponse.<T>builder()
|
||||
.success(false)
|
||||
.errorCode(errorCode)
|
||||
.message(message)
|
||||
.errorDetails(errorDetails)
|
||||
.timestamp(LocalDateTime.now())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* Wrapper standard pour toutes les réponses API - Architecture 2025
|
||||
*
|
||||
* Format uniforme pour toutes les réponses REST :
|
||||
* {
|
||||
* "data": {...},
|
||||
* "success": true,
|
||||
* "message": "...",
|
||||
* "timestamp": "2025-01-30T10:00:00"
|
||||
* }
|
||||
*
|
||||
* @param <T> Le type de données retournées
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class ApiResponse<T> {
|
||||
|
||||
/**
|
||||
* Les données retournées (peut être null en cas d'erreur)
|
||||
*/
|
||||
private T data;
|
||||
|
||||
/**
|
||||
* Indique si l'opération a réussi
|
||||
*/
|
||||
@Builder.Default
|
||||
private Boolean success = true;
|
||||
|
||||
/**
|
||||
* Message descriptif (optionnel, souvent utilisé pour les erreurs)
|
||||
*/
|
||||
private String message;
|
||||
|
||||
/**
|
||||
* Timestamp de la réponse
|
||||
*/
|
||||
@Builder.Default
|
||||
private LocalDateTime timestamp = LocalDateTime.now();
|
||||
|
||||
/**
|
||||
* Code d'erreur (optionnel, utilisé uniquement en cas d'erreur)
|
||||
*/
|
||||
private String errorCode;
|
||||
|
||||
/**
|
||||
* Détails de l'erreur (optionnel, utilisé uniquement en cas d'erreur)
|
||||
*/
|
||||
private Object errorDetails;
|
||||
|
||||
// === MÉTHODES STATIQUES DE FACTORY ===
|
||||
|
||||
/**
|
||||
* Crée une réponse de succès avec des données
|
||||
*/
|
||||
public static <T> ApiResponse<T> success(T data) {
|
||||
return ApiResponse.<T>builder()
|
||||
.data(data)
|
||||
.success(true)
|
||||
.timestamp(LocalDateTime.now())
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Crée une réponse de succès avec des données et un message
|
||||
*/
|
||||
public static <T> ApiResponse<T> success(T data, String message) {
|
||||
return ApiResponse.<T>builder()
|
||||
.data(data)
|
||||
.success(true)
|
||||
.message(message)
|
||||
.timestamp(LocalDateTime.now())
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Crée une réponse de succès sans données (pour DELETE, etc.)
|
||||
*/
|
||||
public static <T> ApiResponse<T> success(String message) {
|
||||
return ApiResponse.<T>builder()
|
||||
.success(true)
|
||||
.message(message)
|
||||
.timestamp(LocalDateTime.now())
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Crée une réponse d'erreur
|
||||
*/
|
||||
public static <T> ApiResponse<T> error(String message) {
|
||||
return ApiResponse.<T>builder()
|
||||
.success(false)
|
||||
.message(message)
|
||||
.timestamp(LocalDateTime.now())
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Crée une réponse d'erreur avec code
|
||||
*/
|
||||
public static <T> ApiResponse<T> error(String errorCode, String message) {
|
||||
return ApiResponse.<T>builder()
|
||||
.success(false)
|
||||
.errorCode(errorCode)
|
||||
.message(message)
|
||||
.timestamp(LocalDateTime.now())
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Crée une réponse d'erreur avec code et détails
|
||||
*/
|
||||
public static <T> ApiResponse<T> error(String errorCode, String message, Object errorDetails) {
|
||||
return ApiResponse.<T>builder()
|
||||
.success(false)
|
||||
.errorCode(errorCode)
|
||||
.message(message)
|
||||
.errorDetails(errorDetails)
|
||||
.timestamp(LocalDateTime.now())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,88 +1,88 @@
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.PrioriteBonCommande;
|
||||
import dev.lions.btpxpress.domain.core.entity.TypeBonCommande;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la création d'un bon de commande - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class BonCommandeCreateDTO {
|
||||
|
||||
@NotBlank(message = "Le numéro est obligatoire")
|
||||
private String numero;
|
||||
|
||||
private String numeroInterne;
|
||||
|
||||
private String objet;
|
||||
|
||||
private String description;
|
||||
|
||||
@NotNull(message = "Le fournisseur est obligatoire")
|
||||
private UUID fournisseurId;
|
||||
|
||||
private UUID chantierId;
|
||||
|
||||
private UUID demandeurId;
|
||||
|
||||
private PrioriteBonCommande priorite;
|
||||
|
||||
private TypeBonCommande typeCommande;
|
||||
|
||||
private LocalDate dateCommande;
|
||||
|
||||
private LocalDate dateBesoin;
|
||||
|
||||
private LocalDate dateLivraisonPrevue;
|
||||
|
||||
private BigDecimal montantHT;
|
||||
|
||||
private BigDecimal remisePourcentage;
|
||||
|
||||
private BigDecimal remiseMontant;
|
||||
|
||||
private BigDecimal fraisPort;
|
||||
|
||||
private String adresseLivraison;
|
||||
|
||||
private String adresseFacturation;
|
||||
|
||||
private String contactFournisseur;
|
||||
|
||||
private String emailContact;
|
||||
|
||||
private String telephoneContact;
|
||||
|
||||
private String referenceFournisseur;
|
||||
|
||||
private String numeroDevis;
|
||||
|
||||
private Boolean livraisonPartielleAutorisee;
|
||||
|
||||
private Boolean controleReceptionRequis;
|
||||
|
||||
private Boolean urgente;
|
||||
|
||||
private Boolean confidentielle;
|
||||
|
||||
private String commentaires;
|
||||
|
||||
private String notesInternes;
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.PrioriteBonCommande;
|
||||
import dev.lions.btpxpress.domain.core.entity.TypeBonCommande;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la création d'un bon de commande - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class BonCommandeCreateDTO {
|
||||
|
||||
@NotBlank(message = "Le numéro est obligatoire")
|
||||
private String numero;
|
||||
|
||||
private String numeroInterne;
|
||||
|
||||
private String objet;
|
||||
|
||||
private String description;
|
||||
|
||||
@NotNull(message = "Le fournisseur est obligatoire")
|
||||
private UUID fournisseurId;
|
||||
|
||||
private UUID chantierId;
|
||||
|
||||
private UUID demandeurId;
|
||||
|
||||
private PrioriteBonCommande priorite;
|
||||
|
||||
private TypeBonCommande typeCommande;
|
||||
|
||||
private LocalDate dateCommande;
|
||||
|
||||
private LocalDate dateBesoin;
|
||||
|
||||
private LocalDate dateLivraisonPrevue;
|
||||
|
||||
private BigDecimal montantHT;
|
||||
|
||||
private BigDecimal remisePourcentage;
|
||||
|
||||
private BigDecimal remiseMontant;
|
||||
|
||||
private BigDecimal fraisPort;
|
||||
|
||||
private String adresseLivraison;
|
||||
|
||||
private String adresseFacturation;
|
||||
|
||||
private String contactFournisseur;
|
||||
|
||||
private String emailContact;
|
||||
|
||||
private String telephoneContact;
|
||||
|
||||
private String referenceFournisseur;
|
||||
|
||||
private String numeroDevis;
|
||||
|
||||
private Boolean livraisonPartielleAutorisee;
|
||||
|
||||
private Boolean controleReceptionRequis;
|
||||
|
||||
private Boolean urgente;
|
||||
|
||||
private Boolean confidentielle;
|
||||
|
||||
private String commentaires;
|
||||
|
||||
private String notesInternes;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,139 +1,139 @@
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.PrioriteBonCommande;
|
||||
import dev.lions.btpxpress.domain.core.entity.StatutBonCommande;
|
||||
import dev.lions.btpxpress.domain.core.entity.TypeBonCommande;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la réponse d'un bon de commande - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class BonCommandeResponseDTO {
|
||||
|
||||
private UUID id;
|
||||
|
||||
private String numero;
|
||||
|
||||
private String numeroInterne;
|
||||
|
||||
private String objet;
|
||||
|
||||
private String description;
|
||||
|
||||
private StatutBonCommande statut;
|
||||
|
||||
private PrioriteBonCommande priorite;
|
||||
|
||||
private TypeBonCommande typeCommande;
|
||||
|
||||
private LocalDate dateCommande;
|
||||
|
||||
private LocalDate dateBesoin;
|
||||
|
||||
private LocalDate dateLivraisonPrevue;
|
||||
|
||||
private LocalDate dateLivraisonReelle;
|
||||
|
||||
private LocalDate dateValidation;
|
||||
|
||||
private LocalDate dateEnvoi;
|
||||
|
||||
private LocalDate dateAccuseReception;
|
||||
|
||||
private BigDecimal montantHT;
|
||||
|
||||
private BigDecimal montantTVA;
|
||||
|
||||
private BigDecimal montantTTC;
|
||||
|
||||
private BigDecimal remisePourcentage;
|
||||
|
||||
private BigDecimal remiseMontant;
|
||||
|
||||
private BigDecimal fraisPort;
|
||||
|
||||
private BigDecimal autreFrais;
|
||||
|
||||
private String adresseLivraison;
|
||||
|
||||
private String adresseFacturation;
|
||||
|
||||
private String contactFournisseur;
|
||||
|
||||
private String emailContact;
|
||||
|
||||
private String telephoneContact;
|
||||
|
||||
private String referenceFournisseur;
|
||||
|
||||
private String numeroDevis;
|
||||
|
||||
private String referenceMarche;
|
||||
|
||||
private Boolean livraisonPartielleAutorisee;
|
||||
|
||||
private Boolean controleReceptionRequis;
|
||||
|
||||
private Boolean urgente;
|
||||
|
||||
private Boolean confidentielle;
|
||||
|
||||
private Boolean factureRecue;
|
||||
|
||||
private LocalDate dateReceptionFacture;
|
||||
|
||||
private String numeroFacture;
|
||||
|
||||
private String commentaires;
|
||||
|
||||
private String notesInternes;
|
||||
|
||||
private String conditionsParticulieres;
|
||||
|
||||
private String motifAnnulation;
|
||||
|
||||
// Relations simplifiées
|
||||
private UUID fournisseurId;
|
||||
private String fournisseurNom;
|
||||
|
||||
private UUID chantierId;
|
||||
private String chantierNom;
|
||||
|
||||
private UUID demandeurId;
|
||||
private String demandeurNom;
|
||||
|
||||
private UUID valideurId;
|
||||
private String valideurNom;
|
||||
|
||||
// Lignes de commande (simplifiées)
|
||||
private Integer nombreLignes;
|
||||
|
||||
// Métadonnées
|
||||
private LocalDateTime dateCreation;
|
||||
|
||||
private LocalDateTime dateModification;
|
||||
|
||||
private String creePar;
|
||||
|
||||
private String modifiePar;
|
||||
|
||||
private String validePar;
|
||||
|
||||
private String envoyePar;
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.PrioriteBonCommande;
|
||||
import dev.lions.btpxpress.domain.core.entity.StatutBonCommande;
|
||||
import dev.lions.btpxpress.domain.core.entity.TypeBonCommande;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la réponse d'un bon de commande - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class BonCommandeResponseDTO {
|
||||
|
||||
private UUID id;
|
||||
|
||||
private String numero;
|
||||
|
||||
private String numeroInterne;
|
||||
|
||||
private String objet;
|
||||
|
||||
private String description;
|
||||
|
||||
private StatutBonCommande statut;
|
||||
|
||||
private PrioriteBonCommande priorite;
|
||||
|
||||
private TypeBonCommande typeCommande;
|
||||
|
||||
private LocalDate dateCommande;
|
||||
|
||||
private LocalDate dateBesoin;
|
||||
|
||||
private LocalDate dateLivraisonPrevue;
|
||||
|
||||
private LocalDate dateLivraisonReelle;
|
||||
|
||||
private LocalDate dateValidation;
|
||||
|
||||
private LocalDate dateEnvoi;
|
||||
|
||||
private LocalDate dateAccuseReception;
|
||||
|
||||
private BigDecimal montantHT;
|
||||
|
||||
private BigDecimal montantTVA;
|
||||
|
||||
private BigDecimal montantTTC;
|
||||
|
||||
private BigDecimal remisePourcentage;
|
||||
|
||||
private BigDecimal remiseMontant;
|
||||
|
||||
private BigDecimal fraisPort;
|
||||
|
||||
private BigDecimal autreFrais;
|
||||
|
||||
private String adresseLivraison;
|
||||
|
||||
private String adresseFacturation;
|
||||
|
||||
private String contactFournisseur;
|
||||
|
||||
private String emailContact;
|
||||
|
||||
private String telephoneContact;
|
||||
|
||||
private String referenceFournisseur;
|
||||
|
||||
private String numeroDevis;
|
||||
|
||||
private String referenceMarche;
|
||||
|
||||
private Boolean livraisonPartielleAutorisee;
|
||||
|
||||
private Boolean controleReceptionRequis;
|
||||
|
||||
private Boolean urgente;
|
||||
|
||||
private Boolean confidentielle;
|
||||
|
||||
private Boolean factureRecue;
|
||||
|
||||
private LocalDate dateReceptionFacture;
|
||||
|
||||
private String numeroFacture;
|
||||
|
||||
private String commentaires;
|
||||
|
||||
private String notesInternes;
|
||||
|
||||
private String conditionsParticulieres;
|
||||
|
||||
private String motifAnnulation;
|
||||
|
||||
// Relations simplifiées
|
||||
private UUID fournisseurId;
|
||||
private String fournisseurNom;
|
||||
|
||||
private UUID chantierId;
|
||||
private String chantierNom;
|
||||
|
||||
private UUID demandeurId;
|
||||
private String demandeurNom;
|
||||
|
||||
private UUID valideurId;
|
||||
private String valideurNom;
|
||||
|
||||
// Lignes de commande (simplifiées)
|
||||
private Integer nombreLignes;
|
||||
|
||||
// Métadonnées
|
||||
private LocalDateTime dateCreation;
|
||||
|
||||
private LocalDateTime dateModification;
|
||||
|
||||
private String creePar;
|
||||
|
||||
private String modifiePar;
|
||||
|
||||
private String validePar;
|
||||
|
||||
private String envoyePar;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,58 +1,58 @@
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.Budget.StatutBudget;
|
||||
import jakarta.validation.constraints.DecimalMin;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la création de budget - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class BudgetCreateDTO {
|
||||
|
||||
@NotNull(message = "Le chantier est obligatoire")
|
||||
private UUID chantierId;
|
||||
|
||||
@NotNull(message = "Le budget total est obligatoire")
|
||||
@DecimalMin(value = "0.0", inclusive = false, message = "Le budget total doit être positif")
|
||||
private BigDecimal budgetTotal;
|
||||
|
||||
@Builder.Default
|
||||
@DecimalMin(value = "0.0", message = "La dépense réelle doit être positive ou nulle")
|
||||
private BigDecimal depenseReelle = BigDecimal.ZERO;
|
||||
|
||||
@DecimalMin(value = "0.0", message = "L'avancement doit être positif ou nul")
|
||||
@DecimalMin(value = "100.0", message = "L'avancement ne peut pas dépasser 100%")
|
||||
private BigDecimal avancementTravaux;
|
||||
|
||||
@NotNull(message = "Le statut est obligatoire")
|
||||
private StatutBudget statut;
|
||||
|
||||
private String responsable;
|
||||
|
||||
private String prochainJalon;
|
||||
|
||||
private LocalDate dateDerniereMiseAJour;
|
||||
|
||||
/** Méthode de conversion String vers UUID pour chantierId */
|
||||
public void setChantierId(String chantierId) {
|
||||
if (chantierId != null && !chantierId.trim().isEmpty()) {
|
||||
this.chantierId = UUID.fromString(chantierId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.Budget.StatutBudget;
|
||||
import jakarta.validation.constraints.DecimalMin;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la création de budget - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class BudgetCreateDTO {
|
||||
|
||||
@NotNull(message = "Le chantier est obligatoire")
|
||||
private UUID chantierId;
|
||||
|
||||
@NotNull(message = "Le budget total est obligatoire")
|
||||
@DecimalMin(value = "0.0", inclusive = false, message = "Le budget total doit être positif")
|
||||
private BigDecimal budgetTotal;
|
||||
|
||||
@Builder.Default
|
||||
@DecimalMin(value = "0.0", message = "La dépense réelle doit être positive ou nulle")
|
||||
private BigDecimal depenseReelle = BigDecimal.ZERO;
|
||||
|
||||
@DecimalMin(value = "0.0", message = "L'avancement doit être positif ou nul")
|
||||
@DecimalMin(value = "100.0", message = "L'avancement ne peut pas dépasser 100%")
|
||||
private BigDecimal avancementTravaux;
|
||||
|
||||
@NotNull(message = "Le statut est obligatoire")
|
||||
private StatutBudget statut;
|
||||
|
||||
private String responsable;
|
||||
|
||||
private String prochainJalon;
|
||||
|
||||
private LocalDate dateDerniereMiseAJour;
|
||||
|
||||
/** Méthode de conversion String vers UUID pour chantierId */
|
||||
public void setChantierId(String chantierId) {
|
||||
if (chantierId != null && !chantierId.trim().isEmpty()) {
|
||||
this.chantierId = UUID.fromString(chantierId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,60 +1,60 @@
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.Budget.StatutBudget;
|
||||
import dev.lions.btpxpress.domain.core.entity.Budget.TendanceBudget;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la réponse d'un budget - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class BudgetResponseDTO {
|
||||
|
||||
private UUID id;
|
||||
|
||||
private UUID chantierId;
|
||||
private String chantierNom;
|
||||
|
||||
private BigDecimal budgetTotal;
|
||||
|
||||
private BigDecimal depenseReelle;
|
||||
|
||||
private BigDecimal ecart;
|
||||
|
||||
private BigDecimal ecartPourcentage;
|
||||
|
||||
private BigDecimal avancementTravaux;
|
||||
|
||||
private StatutBudget statut;
|
||||
|
||||
private TendanceBudget tendance;
|
||||
|
||||
private String responsable;
|
||||
|
||||
private Integer nombreAlertes;
|
||||
|
||||
private String prochainJalon;
|
||||
|
||||
private LocalDate dateDerniereMiseAJour;
|
||||
|
||||
private Boolean actif;
|
||||
|
||||
private LocalDateTime dateCreation;
|
||||
|
||||
private LocalDateTime dateModification;
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.Budget.StatutBudget;
|
||||
import dev.lions.btpxpress.domain.core.entity.Budget.TendanceBudget;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la réponse d'un budget - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class BudgetResponseDTO {
|
||||
|
||||
private UUID id;
|
||||
|
||||
private UUID chantierId;
|
||||
private String chantierNom;
|
||||
|
||||
private BigDecimal budgetTotal;
|
||||
|
||||
private BigDecimal depenseReelle;
|
||||
|
||||
private BigDecimal ecart;
|
||||
|
||||
private BigDecimal ecartPourcentage;
|
||||
|
||||
private BigDecimal avancementTravaux;
|
||||
|
||||
private StatutBudget statut;
|
||||
|
||||
private TendanceBudget tendance;
|
||||
|
||||
private String responsable;
|
||||
|
||||
private Integer nombreAlertes;
|
||||
|
||||
private String prochainJalon;
|
||||
|
||||
private LocalDate dateDerniereMiseAJour;
|
||||
|
||||
private Boolean actif;
|
||||
|
||||
private LocalDateTime dateCreation;
|
||||
|
||||
private LocalDateTime dateModification;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,73 +1,73 @@
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.StatutChantier;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la réponse d'un chantier - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ChantierResponseDTO {
|
||||
|
||||
private UUID id;
|
||||
|
||||
private String nom;
|
||||
|
||||
private String description;
|
||||
|
||||
private String adresse;
|
||||
|
||||
private String codePostal;
|
||||
|
||||
private String ville;
|
||||
|
||||
private LocalDate dateDebut;
|
||||
|
||||
private LocalDate dateFinPrevue;
|
||||
|
||||
private LocalDate dateFinReelle;
|
||||
|
||||
private StatutChantier statut;
|
||||
|
||||
private BigDecimal montantPrevu;
|
||||
|
||||
private BigDecimal montantReel;
|
||||
|
||||
private BigDecimal montantContrat;
|
||||
|
||||
private BigDecimal coutReel;
|
||||
|
||||
private BigDecimal pourcentageAvancement;
|
||||
|
||||
private Boolean actif;
|
||||
|
||||
private LocalDateTime dateCreation;
|
||||
|
||||
private LocalDateTime dateModification;
|
||||
|
||||
// Relations simplifiées
|
||||
private UUID clientId;
|
||||
private String clientNom;
|
||||
private String clientRaisonSociale;
|
||||
|
||||
private Integer nombrePhases;
|
||||
|
||||
private Integer nombreEmployes;
|
||||
|
||||
private Integer nombreMateriels;
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.StatutChantier;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la réponse d'un chantier - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ChantierResponseDTO {
|
||||
|
||||
private UUID id;
|
||||
|
||||
private String nom;
|
||||
|
||||
private String description;
|
||||
|
||||
private String adresse;
|
||||
|
||||
private String codePostal;
|
||||
|
||||
private String ville;
|
||||
|
||||
private LocalDate dateDebut;
|
||||
|
||||
private LocalDate dateFinPrevue;
|
||||
|
||||
private LocalDate dateFinReelle;
|
||||
|
||||
private StatutChantier statut;
|
||||
|
||||
private BigDecimal montantPrevu;
|
||||
|
||||
private BigDecimal montantReel;
|
||||
|
||||
private BigDecimal montantContrat;
|
||||
|
||||
private BigDecimal coutReel;
|
||||
|
||||
private BigDecimal pourcentageAvancement;
|
||||
|
||||
private Boolean actif;
|
||||
|
||||
private LocalDateTime dateCreation;
|
||||
|
||||
private LocalDateTime dateModification;
|
||||
|
||||
// Relations simplifiées
|
||||
private UUID clientId;
|
||||
private String clientNom;
|
||||
private String clientRaisonSociale;
|
||||
|
||||
private Integer nombrePhases;
|
||||
|
||||
private Integer nombreEmployes;
|
||||
|
||||
private Integer nombreMateriels;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,58 +1,58 @@
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.StatutChantier;
|
||||
import java.time.LocalDate;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la mise à jour de chantier - Architecture 2025
|
||||
* Tous les champs sont optionnels sauf ceux marqués comme obligatoires
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ChantierUpdateDTO {
|
||||
|
||||
private String nom;
|
||||
|
||||
private String description;
|
||||
|
||||
private String adresse;
|
||||
|
||||
private String codePostal;
|
||||
|
||||
private String ville;
|
||||
|
||||
private LocalDate dateDebut;
|
||||
|
||||
private LocalDate dateFinPrevue;
|
||||
|
||||
private LocalDate dateFinReelle;
|
||||
|
||||
private StatutChantier statut;
|
||||
|
||||
private Double montantPrevu;
|
||||
|
||||
private Double montantReel;
|
||||
|
||||
private Boolean actif;
|
||||
|
||||
private UUID clientId;
|
||||
|
||||
/** Méthode de conversion String vers UUID pour clientId */
|
||||
public void setClientId(String clientId) {
|
||||
if (clientId != null && !clientId.trim().isEmpty()) {
|
||||
this.clientId = UUID.fromString(clientId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.StatutChantier;
|
||||
import java.time.LocalDate;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la mise à jour de chantier - Architecture 2025
|
||||
* Tous les champs sont optionnels sauf ceux marqués comme obligatoires
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ChantierUpdateDTO {
|
||||
|
||||
private String nom;
|
||||
|
||||
private String description;
|
||||
|
||||
private String adresse;
|
||||
|
||||
private String codePostal;
|
||||
|
||||
private String ville;
|
||||
|
||||
private LocalDate dateDebut;
|
||||
|
||||
private LocalDate dateFinPrevue;
|
||||
|
||||
private LocalDate dateFinReelle;
|
||||
|
||||
private StatutChantier statut;
|
||||
|
||||
private Double montantPrevu;
|
||||
|
||||
private Double montantReel;
|
||||
|
||||
private Boolean actif;
|
||||
|
||||
private UUID clientId;
|
||||
|
||||
/** Méthode de conversion String vers UUID pour clientId */
|
||||
public void setClientId(String clientId) {
|
||||
if (clientId != null && !clientId.trim().isEmpty()) {
|
||||
this.clientId = UUID.fromString(clientId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,60 +1,60 @@
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la réponse d'un client - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ClientResponseDTO {
|
||||
|
||||
private UUID id;
|
||||
|
||||
private String nom;
|
||||
|
||||
private String prenom;
|
||||
|
||||
private String nomComplet;
|
||||
|
||||
private String entreprise;
|
||||
|
||||
private String email;
|
||||
|
||||
private String telephone;
|
||||
|
||||
private String adresse;
|
||||
|
||||
private String codePostal;
|
||||
|
||||
private String ville;
|
||||
|
||||
private String siret;
|
||||
|
||||
private String numeroTVA;
|
||||
|
||||
private Boolean actif;
|
||||
|
||||
private LocalDateTime dateCreation;
|
||||
|
||||
private LocalDateTime dateModification;
|
||||
|
||||
// Statistiques simplifiées
|
||||
private Integer nombreChantiers;
|
||||
|
||||
private Integer nombreDevis;
|
||||
|
||||
private Integer nombreFactures;
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la réponse d'un client - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ClientResponseDTO {
|
||||
|
||||
private UUID id;
|
||||
|
||||
private String nom;
|
||||
|
||||
private String prenom;
|
||||
|
||||
private String nomComplet;
|
||||
|
||||
private String entreprise;
|
||||
|
||||
private String email;
|
||||
|
||||
private String telephone;
|
||||
|
||||
private String adresse;
|
||||
|
||||
private String codePostal;
|
||||
|
||||
private String ville;
|
||||
|
||||
private String siret;
|
||||
|
||||
private String numeroTVA;
|
||||
|
||||
private Boolean actif;
|
||||
|
||||
private LocalDateTime dateCreation;
|
||||
|
||||
private LocalDateTime dateModification;
|
||||
|
||||
// Statistiques simplifiées
|
||||
private Integer nombreChantiers;
|
||||
|
||||
private Integer nombreDevis;
|
||||
|
||||
private Integer nombreFactures;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,46 +1,46 @@
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import jakarta.validation.constraints.Email;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la mise à jour de client - Architecture 2025
|
||||
* Tous les champs sont optionnels sauf ceux marqués comme obligatoires
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ClientUpdateDTO {
|
||||
|
||||
private String nom;
|
||||
|
||||
private String prenom;
|
||||
|
||||
private String entreprise;
|
||||
|
||||
@Email(message = "L'email doit être valide")
|
||||
private String email;
|
||||
|
||||
private String telephone;
|
||||
|
||||
private String adresse;
|
||||
|
||||
private String codePostal;
|
||||
|
||||
private String ville;
|
||||
|
||||
private String siret;
|
||||
|
||||
private String numeroTVA;
|
||||
|
||||
private Boolean actif;
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import jakarta.validation.constraints.Email;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la mise à jour de client - Architecture 2025
|
||||
* Tous les champs sont optionnels sauf ceux marqués comme obligatoires
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ClientUpdateDTO {
|
||||
|
||||
private String nom;
|
||||
|
||||
private String prenom;
|
||||
|
||||
private String entreprise;
|
||||
|
||||
@Email(message = "L'email doit être valide")
|
||||
private String email;
|
||||
|
||||
private String telephone;
|
||||
|
||||
private String adresse;
|
||||
|
||||
private String codePostal;
|
||||
|
||||
private String ville;
|
||||
|
||||
private String siret;
|
||||
|
||||
private String numeroTVA;
|
||||
|
||||
private Boolean actif;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,99 +1,99 @@
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.StatutDevis;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Positive;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la création de devis - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class DevisCreateDTO {
|
||||
|
||||
@NotBlank(message = "Le numéro de devis est obligatoire")
|
||||
private String numero;
|
||||
|
||||
@NotBlank(message = "L'objet du devis est obligatoire")
|
||||
private String objet;
|
||||
|
||||
private String description;
|
||||
|
||||
@NotNull(message = "La date d'émission est obligatoire")
|
||||
private LocalDate dateEmission;
|
||||
|
||||
@NotNull(message = "La date de validité est obligatoire")
|
||||
private LocalDate dateValidite;
|
||||
|
||||
@Builder.Default
|
||||
private StatutDevis statut = StatutDevis.BROUILLON;
|
||||
|
||||
@Positive(message = "Le montant HT doit être positif")
|
||||
private BigDecimal montantHT;
|
||||
|
||||
@Builder.Default
|
||||
private BigDecimal tauxTVA = BigDecimal.valueOf(20.0);
|
||||
|
||||
private String conditionsPaiement;
|
||||
|
||||
private Integer delaiExecution; // en jours
|
||||
|
||||
@NotNull(message = "Le client est obligatoire")
|
||||
private UUID clientId;
|
||||
|
||||
private UUID chantierId; // Optionnel
|
||||
|
||||
private List<LigneDevisCreateDTO> lignes;
|
||||
|
||||
/** Méthode de conversion String vers UUID pour clientId */
|
||||
public void setClientId(String clientId) {
|
||||
if (clientId != null && !clientId.trim().isEmpty()) {
|
||||
this.clientId = UUID.fromString(clientId);
|
||||
}
|
||||
}
|
||||
|
||||
/** Méthode de conversion String vers UUID pour chantierId */
|
||||
public void setChantierId(String chantierId) {
|
||||
if (chantierId != null && !chantierId.trim().isEmpty()) {
|
||||
this.chantierId = UUID.fromString(chantierId);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* DTO pour une ligne de devis
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class LigneDevisCreateDTO {
|
||||
@NotBlank(message = "La description de la ligne est obligatoire")
|
||||
private String description;
|
||||
|
||||
@Positive(message = "La quantité doit être positive")
|
||||
private BigDecimal quantite;
|
||||
|
||||
@Positive(message = "Le prix unitaire doit être positif")
|
||||
private BigDecimal prixUnitaire;
|
||||
|
||||
private BigDecimal tauxTVA;
|
||||
|
||||
private String unite;
|
||||
}
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.StatutDevis;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Positive;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la création de devis - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class DevisCreateDTO {
|
||||
|
||||
@NotBlank(message = "Le numéro de devis est obligatoire")
|
||||
private String numero;
|
||||
|
||||
@NotBlank(message = "L'objet du devis est obligatoire")
|
||||
private String objet;
|
||||
|
||||
private String description;
|
||||
|
||||
@NotNull(message = "La date d'émission est obligatoire")
|
||||
private LocalDate dateEmission;
|
||||
|
||||
@NotNull(message = "La date de validité est obligatoire")
|
||||
private LocalDate dateValidite;
|
||||
|
||||
@Builder.Default
|
||||
private StatutDevis statut = StatutDevis.BROUILLON;
|
||||
|
||||
@Positive(message = "Le montant HT doit être positif")
|
||||
private BigDecimal montantHT;
|
||||
|
||||
@Builder.Default
|
||||
private BigDecimal tauxTVA = BigDecimal.valueOf(20.0);
|
||||
|
||||
private String conditionsPaiement;
|
||||
|
||||
private Integer delaiExecution; // en jours
|
||||
|
||||
@NotNull(message = "Le client est obligatoire")
|
||||
private UUID clientId;
|
||||
|
||||
private UUID chantierId; // Optionnel
|
||||
|
||||
private List<LigneDevisCreateDTO> lignes;
|
||||
|
||||
/** Méthode de conversion String vers UUID pour clientId */
|
||||
public void setClientId(String clientId) {
|
||||
if (clientId != null && !clientId.trim().isEmpty()) {
|
||||
this.clientId = UUID.fromString(clientId);
|
||||
}
|
||||
}
|
||||
|
||||
/** Méthode de conversion String vers UUID pour chantierId */
|
||||
public void setChantierId(String chantierId) {
|
||||
if (chantierId != null && !chantierId.trim().isEmpty()) {
|
||||
this.chantierId = UUID.fromString(chantierId);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* DTO pour une ligne de devis
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class LigneDevisCreateDTO {
|
||||
@NotBlank(message = "La description de la ligne est obligatoire")
|
||||
private String description;
|
||||
|
||||
@Positive(message = "La quantité doit être positive")
|
||||
private BigDecimal quantite;
|
||||
|
||||
@Positive(message = "Le prix unitaire doit être positif")
|
||||
private BigDecimal prixUnitaire;
|
||||
|
||||
private BigDecimal tauxTVA;
|
||||
|
||||
private String unite;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,89 +1,89 @@
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.StatutDevis;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la réponse d'un devis - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class DevisResponseDTO {
|
||||
|
||||
private UUID id;
|
||||
|
||||
private String numero;
|
||||
|
||||
private String objet;
|
||||
|
||||
private String description;
|
||||
|
||||
private LocalDate dateEmission;
|
||||
|
||||
private LocalDate dateValidite;
|
||||
|
||||
private StatutDevis statut;
|
||||
|
||||
private BigDecimal montantHT;
|
||||
|
||||
private BigDecimal tauxTVA;
|
||||
|
||||
private BigDecimal montantTVA;
|
||||
|
||||
private BigDecimal montantTTC;
|
||||
|
||||
private String conditionsPaiement;
|
||||
|
||||
private Integer delaiExecution;
|
||||
|
||||
private Boolean actif;
|
||||
|
||||
private LocalDateTime dateCreation;
|
||||
|
||||
private LocalDateTime dateModification;
|
||||
|
||||
// Relations simplifiées
|
||||
private UUID clientId;
|
||||
private String clientNom;
|
||||
private String clientRaisonSociale;
|
||||
|
||||
private UUID chantierId;
|
||||
private String chantierNom;
|
||||
|
||||
private List<LigneDevisResponseDTO> lignes;
|
||||
|
||||
/**
|
||||
* DTO pour une ligne de devis en réponse
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class LigneDevisResponseDTO {
|
||||
private UUID id;
|
||||
private String description;
|
||||
private BigDecimal quantite;
|
||||
private BigDecimal prixUnitaire;
|
||||
private BigDecimal tauxTVA;
|
||||
private BigDecimal montantHT;
|
||||
private BigDecimal montantTVA;
|
||||
private BigDecimal montantTTC;
|
||||
private String unite;
|
||||
private Integer ordre;
|
||||
}
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.StatutDevis;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la réponse d'un devis - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class DevisResponseDTO {
|
||||
|
||||
private UUID id;
|
||||
|
||||
private String numero;
|
||||
|
||||
private String objet;
|
||||
|
||||
private String description;
|
||||
|
||||
private LocalDate dateEmission;
|
||||
|
||||
private LocalDate dateValidite;
|
||||
|
||||
private StatutDevis statut;
|
||||
|
||||
private BigDecimal montantHT;
|
||||
|
||||
private BigDecimal tauxTVA;
|
||||
|
||||
private BigDecimal montantTVA;
|
||||
|
||||
private BigDecimal montantTTC;
|
||||
|
||||
private String conditionsPaiement;
|
||||
|
||||
private Integer delaiExecution;
|
||||
|
||||
private Boolean actif;
|
||||
|
||||
private LocalDateTime dateCreation;
|
||||
|
||||
private LocalDateTime dateModification;
|
||||
|
||||
// Relations simplifiées
|
||||
private UUID clientId;
|
||||
private String clientNom;
|
||||
private String clientRaisonSociale;
|
||||
|
||||
private UUID chantierId;
|
||||
private String chantierNom;
|
||||
|
||||
private List<LigneDevisResponseDTO> lignes;
|
||||
|
||||
/**
|
||||
* DTO pour une ligne de devis en réponse
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class LigneDevisResponseDTO {
|
||||
private UUID id;
|
||||
private String description;
|
||||
private BigDecimal quantite;
|
||||
private BigDecimal prixUnitaire;
|
||||
private BigDecimal tauxTVA;
|
||||
private BigDecimal montantHT;
|
||||
private BigDecimal montantTVA;
|
||||
private BigDecimal montantTTC;
|
||||
private String unite;
|
||||
private Integer ordre;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,41 +1,41 @@
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.TypeDisponibilite;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la création d'une disponibilité - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class DisponibiliteCreateDTO {
|
||||
|
||||
@NotNull(message = "L'employé est obligatoire")
|
||||
private UUID employeId;
|
||||
|
||||
@NotNull(message = "La date de début est obligatoire")
|
||||
private LocalDateTime dateDebut;
|
||||
|
||||
@NotNull(message = "La date de fin est obligatoire")
|
||||
private LocalDateTime dateFin;
|
||||
|
||||
@NotNull(message = "Le type de disponibilité est obligatoire")
|
||||
private TypeDisponibilite type;
|
||||
|
||||
private String motif;
|
||||
|
||||
private Boolean approuvee;
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.TypeDisponibilite;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la création d'une disponibilité - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class DisponibiliteCreateDTO {
|
||||
|
||||
@NotNull(message = "L'employé est obligatoire")
|
||||
private UUID employeId;
|
||||
|
||||
@NotNull(message = "La date de début est obligatoire")
|
||||
private LocalDateTime dateDebut;
|
||||
|
||||
@NotNull(message = "La date de fin est obligatoire")
|
||||
private LocalDateTime dateFin;
|
||||
|
||||
@NotNull(message = "Le type de disponibilité est obligatoire")
|
||||
private TypeDisponibilite type;
|
||||
|
||||
private String motif;
|
||||
|
||||
private Boolean approuvee;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,50 +1,50 @@
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.TypeDisponibilite;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la réponse d'une disponibilité - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class DisponibiliteResponseDTO {
|
||||
|
||||
private UUID id;
|
||||
|
||||
private LocalDateTime dateDebut;
|
||||
|
||||
private LocalDateTime dateFin;
|
||||
|
||||
private TypeDisponibilite type;
|
||||
|
||||
private String motif;
|
||||
|
||||
private Boolean approuvee;
|
||||
|
||||
private LocalDateTime dateCreation;
|
||||
|
||||
private LocalDateTime dateModification;
|
||||
|
||||
// Relations simplifiées
|
||||
private UUID employeId;
|
||||
private String employeNom;
|
||||
private String employePrenom;
|
||||
|
||||
// Métadonnées calculées
|
||||
private Long dureeEnHeures;
|
||||
|
||||
private Boolean active;
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.TypeDisponibilite;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la réponse d'une disponibilité - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class DisponibiliteResponseDTO {
|
||||
|
||||
private UUID id;
|
||||
|
||||
private LocalDateTime dateDebut;
|
||||
|
||||
private LocalDateTime dateFin;
|
||||
|
||||
private TypeDisponibilite type;
|
||||
|
||||
private String motif;
|
||||
|
||||
private Boolean approuvee;
|
||||
|
||||
private LocalDateTime dateCreation;
|
||||
|
||||
private LocalDateTime dateModification;
|
||||
|
||||
// Relations simplifiées
|
||||
private UUID employeId;
|
||||
private String employeNom;
|
||||
private String employePrenom;
|
||||
|
||||
// Métadonnées calculées
|
||||
private Long dureeEnHeures;
|
||||
|
||||
private Boolean active;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,58 +1,58 @@
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.TypeDocument;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la création d'un document - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class DocumentCreateDTO {
|
||||
|
||||
@NotBlank(message = "Le nom est obligatoire")
|
||||
private String nom;
|
||||
|
||||
private String description;
|
||||
|
||||
@NotBlank(message = "Le nom du fichier est obligatoire")
|
||||
private String nomFichier;
|
||||
|
||||
@NotBlank(message = "Le chemin du fichier est obligatoire")
|
||||
private String cheminFichier;
|
||||
|
||||
@NotBlank(message = "Le type MIME est obligatoire")
|
||||
private String typeMime;
|
||||
|
||||
@NotNull(message = "La taille du fichier est obligatoire")
|
||||
private Long tailleFichier;
|
||||
|
||||
@NotNull(message = "Le type de document est obligatoire")
|
||||
private TypeDocument typeDocument;
|
||||
|
||||
// Relations optionnelles
|
||||
private UUID chantierId;
|
||||
private UUID materielId;
|
||||
private UUID employeId;
|
||||
private UUID equipeId;
|
||||
private UUID clientId;
|
||||
|
||||
private String tags;
|
||||
|
||||
private Boolean estPublic;
|
||||
|
||||
private Boolean actif;
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.TypeDocument;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la création d'un document - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class DocumentCreateDTO {
|
||||
|
||||
@NotBlank(message = "Le nom est obligatoire")
|
||||
private String nom;
|
||||
|
||||
private String description;
|
||||
|
||||
@NotBlank(message = "Le nom du fichier est obligatoire")
|
||||
private String nomFichier;
|
||||
|
||||
@NotBlank(message = "Le chemin du fichier est obligatoire")
|
||||
private String cheminFichier;
|
||||
|
||||
@NotBlank(message = "Le type MIME est obligatoire")
|
||||
private String typeMime;
|
||||
|
||||
@NotNull(message = "La taille du fichier est obligatoire")
|
||||
private Long tailleFichier;
|
||||
|
||||
@NotNull(message = "Le type de document est obligatoire")
|
||||
private TypeDocument typeDocument;
|
||||
|
||||
// Relations optionnelles
|
||||
private UUID chantierId;
|
||||
private UUID materielId;
|
||||
private UUID employeId;
|
||||
private UUID equipeId;
|
||||
private UUID clientId;
|
||||
|
||||
private String tags;
|
||||
|
||||
private Boolean estPublic;
|
||||
|
||||
private Boolean actif;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,79 +1,79 @@
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.TypeDocument;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la réponse d'un document - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class DocumentResponseDTO {
|
||||
|
||||
private UUID id;
|
||||
|
||||
private String nom;
|
||||
|
||||
private String description;
|
||||
|
||||
private String nomFichier;
|
||||
|
||||
private String cheminFichier;
|
||||
|
||||
private String typeMime;
|
||||
|
||||
private Long tailleFichier;
|
||||
|
||||
private TypeDocument typeDocument;
|
||||
|
||||
private String tags;
|
||||
|
||||
private Boolean estPublic;
|
||||
|
||||
private Boolean actif;
|
||||
|
||||
private LocalDateTime dateCreation;
|
||||
|
||||
private LocalDateTime dateModification;
|
||||
|
||||
// Relations simplifiées
|
||||
private UUID chantierId;
|
||||
private String chantierNom;
|
||||
|
||||
private UUID materielId;
|
||||
private String materielNom;
|
||||
|
||||
private UUID employeId;
|
||||
private String employeNom;
|
||||
private String employePrenom;
|
||||
|
||||
private UUID equipeId;
|
||||
private String equipeNom;
|
||||
|
||||
private UUID clientId;
|
||||
private String clientNom;
|
||||
|
||||
private UUID creeParId;
|
||||
private String creeParNom;
|
||||
|
||||
// Métadonnées calculées
|
||||
private String extension;
|
||||
|
||||
private String tailleFormatee;
|
||||
|
||||
private Boolean isImage;
|
||||
|
||||
private Boolean isPdf;
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.TypeDocument;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la réponse d'un document - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class DocumentResponseDTO {
|
||||
|
||||
private UUID id;
|
||||
|
||||
private String nom;
|
||||
|
||||
private String description;
|
||||
|
||||
private String nomFichier;
|
||||
|
||||
private String cheminFichier;
|
||||
|
||||
private String typeMime;
|
||||
|
||||
private Long tailleFichier;
|
||||
|
||||
private TypeDocument typeDocument;
|
||||
|
||||
private String tags;
|
||||
|
||||
private Boolean estPublic;
|
||||
|
||||
private Boolean actif;
|
||||
|
||||
private LocalDateTime dateCreation;
|
||||
|
||||
private LocalDateTime dateModification;
|
||||
|
||||
// Relations simplifiées
|
||||
private UUID chantierId;
|
||||
private String chantierNom;
|
||||
|
||||
private UUID materielId;
|
||||
private String materielNom;
|
||||
|
||||
private UUID employeId;
|
||||
private String employeNom;
|
||||
private String employePrenom;
|
||||
|
||||
private UUID equipeId;
|
||||
private String equipeNom;
|
||||
|
||||
private UUID clientId;
|
||||
private String clientNom;
|
||||
|
||||
private UUID creeParId;
|
||||
private String creeParNom;
|
||||
|
||||
// Métadonnées calculées
|
||||
private String extension;
|
||||
|
||||
private String tailleFormatee;
|
||||
|
||||
private Boolean isImage;
|
||||
|
||||
private Boolean isPdf;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,69 +1,69 @@
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.FonctionEmploye;
|
||||
import dev.lions.btpxpress.domain.core.entity.StatutEmploye;
|
||||
import jakarta.validation.constraints.Email;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la création d'employé - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class EmployeCreateDTO {
|
||||
|
||||
@NotBlank(message = "Le nom est obligatoire")
|
||||
private String nom;
|
||||
|
||||
@NotBlank(message = "Le prénom est obligatoire")
|
||||
private String prenom;
|
||||
|
||||
@Email(message = "Email invalide")
|
||||
private String email;
|
||||
|
||||
@Pattern(
|
||||
regexp = "^(?:(?:\\+|00)33|0)\\s*[1-9](?:[\\s.-]*\\d{2}){4}$",
|
||||
message = "Numéro de téléphone invalide")
|
||||
private String telephone;
|
||||
|
||||
@NotBlank(message = "Le poste est obligatoire")
|
||||
private String poste;
|
||||
|
||||
private FonctionEmploye fonction;
|
||||
|
||||
private List<String> specialites;
|
||||
|
||||
private BigDecimal tauxHoraire;
|
||||
|
||||
@NotNull(message = "La date d'embauche est obligatoire")
|
||||
private LocalDate dateEmbauche;
|
||||
|
||||
@Builder.Default
|
||||
private StatutEmploye statut = StatutEmploye.ACTIF;
|
||||
|
||||
private UUID equipeId;
|
||||
|
||||
/** Méthode de conversion String vers UUID pour equipeId */
|
||||
public void setEquipeId(String equipeId) {
|
||||
if (equipeId != null && !equipeId.trim().isEmpty()) {
|
||||
this.equipeId = UUID.fromString(equipeId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.FonctionEmploye;
|
||||
import dev.lions.btpxpress.domain.core.entity.StatutEmploye;
|
||||
import jakarta.validation.constraints.Email;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la création d'employé - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class EmployeCreateDTO {
|
||||
|
||||
@NotBlank(message = "Le nom est obligatoire")
|
||||
private String nom;
|
||||
|
||||
@NotBlank(message = "Le prénom est obligatoire")
|
||||
private String prenom;
|
||||
|
||||
@Email(message = "Email invalide")
|
||||
private String email;
|
||||
|
||||
@Pattern(
|
||||
regexp = "^(?:(?:\\+|00)33|0)\\s*[1-9](?:[\\s.-]*\\d{2}){4}$",
|
||||
message = "Numéro de téléphone invalide")
|
||||
private String telephone;
|
||||
|
||||
@NotBlank(message = "Le poste est obligatoire")
|
||||
private String poste;
|
||||
|
||||
private FonctionEmploye fonction;
|
||||
|
||||
private List<String> specialites;
|
||||
|
||||
private BigDecimal tauxHoraire;
|
||||
|
||||
@NotNull(message = "La date d'embauche est obligatoire")
|
||||
private LocalDate dateEmbauche;
|
||||
|
||||
@Builder.Default
|
||||
private StatutEmploye statut = StatutEmploye.ACTIF;
|
||||
|
||||
private UUID equipeId;
|
||||
|
||||
/** Méthode de conversion String vers UUID pour equipeId */
|
||||
public void setEquipeId(String equipeId) {
|
||||
if (equipeId != null && !equipeId.trim().isEmpty()) {
|
||||
this.equipeId = UUID.fromString(equipeId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,66 +1,66 @@
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.FonctionEmploye;
|
||||
import dev.lions.btpxpress.domain.core.entity.StatutEmploye;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la réponse d'un employé - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class EmployeResponseDTO {
|
||||
|
||||
private UUID id;
|
||||
|
||||
private String nom;
|
||||
|
||||
private String prenom;
|
||||
|
||||
private String nomComplet;
|
||||
|
||||
private String email;
|
||||
|
||||
private String telephone;
|
||||
|
||||
private String poste;
|
||||
|
||||
private FonctionEmploye fonction;
|
||||
|
||||
private List<String> specialites;
|
||||
|
||||
private BigDecimal tauxHoraire;
|
||||
|
||||
private LocalDate dateEmbauche;
|
||||
|
||||
private StatutEmploye statut;
|
||||
|
||||
private Boolean actif;
|
||||
|
||||
private LocalDateTime dateCreation;
|
||||
|
||||
private LocalDateTime dateModification;
|
||||
|
||||
// Relations simplifiées
|
||||
private UUID equipeId;
|
||||
private String equipeNom;
|
||||
|
||||
private Integer nombreDisponibilites;
|
||||
|
||||
private Integer nombreCompetences;
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.FonctionEmploye;
|
||||
import dev.lions.btpxpress.domain.core.entity.StatutEmploye;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la réponse d'un employé - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class EmployeResponseDTO {
|
||||
|
||||
private UUID id;
|
||||
|
||||
private String nom;
|
||||
|
||||
private String prenom;
|
||||
|
||||
private String nomComplet;
|
||||
|
||||
private String email;
|
||||
|
||||
private String telephone;
|
||||
|
||||
private String poste;
|
||||
|
||||
private FonctionEmploye fonction;
|
||||
|
||||
private List<String> specialites;
|
||||
|
||||
private BigDecimal tauxHoraire;
|
||||
|
||||
private LocalDate dateEmbauche;
|
||||
|
||||
private StatutEmploye statut;
|
||||
|
||||
private Boolean actif;
|
||||
|
||||
private LocalDateTime dateCreation;
|
||||
|
||||
private LocalDateTime dateModification;
|
||||
|
||||
// Relations simplifiées
|
||||
private UUID equipeId;
|
||||
private String equipeNom;
|
||||
|
||||
private Integer nombreDisponibilites;
|
||||
|
||||
private Integer nombreCompetences;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,94 +1,94 @@
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.TypeAbonnement;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la création d'un profil d'entreprise - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class EntrepriseProfileCreateDTO {
|
||||
|
||||
@NotNull(message = "Le propriétaire est obligatoire")
|
||||
private UUID proprietaireId;
|
||||
|
||||
@NotBlank(message = "Le nom commercial est obligatoire")
|
||||
private String nomCommercial;
|
||||
|
||||
private String description;
|
||||
|
||||
private String slogan;
|
||||
|
||||
private List<String> specialites;
|
||||
|
||||
private List<String> certifications;
|
||||
|
||||
private String adresseComplete;
|
||||
|
||||
private String codePostal;
|
||||
|
||||
private String ville;
|
||||
|
||||
private String departement;
|
||||
|
||||
private String region;
|
||||
|
||||
private List<String> zonesIntervention;
|
||||
|
||||
private String siteWeb;
|
||||
|
||||
private String emailContact;
|
||||
|
||||
private String telephoneCommercial;
|
||||
|
||||
private String logoUrl;
|
||||
|
||||
private List<String> photosRealisations;
|
||||
|
||||
private BigDecimal noteGlobale;
|
||||
|
||||
private Integer nombreAvis;
|
||||
|
||||
private Integer nombreProjetsRealises;
|
||||
|
||||
private Integer nombreClientsServis;
|
||||
|
||||
private Boolean visible;
|
||||
|
||||
private Boolean certifie;
|
||||
|
||||
private TypeAbonnement typeAbonnement;
|
||||
|
||||
private LocalDateTime finAbonnement;
|
||||
|
||||
private BigDecimal budgetMinProjet;
|
||||
|
||||
private BigDecimal budgetMaxProjet;
|
||||
|
||||
private Boolean accepteUrgences;
|
||||
|
||||
private Boolean accepteWeekends;
|
||||
|
||||
private Integer delaiMoyenIntervention;
|
||||
|
||||
private BigDecimal chiffresAffairesAnnuel;
|
||||
|
||||
private String garantiesProposees;
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.TypeAbonnement;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la création d'un profil d'entreprise - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class EntrepriseProfileCreateDTO {
|
||||
|
||||
@NotNull(message = "Le propriétaire est obligatoire")
|
||||
private UUID proprietaireId;
|
||||
|
||||
@NotBlank(message = "Le nom commercial est obligatoire")
|
||||
private String nomCommercial;
|
||||
|
||||
private String description;
|
||||
|
||||
private String slogan;
|
||||
|
||||
private List<String> specialites;
|
||||
|
||||
private List<String> certifications;
|
||||
|
||||
private String adresseComplete;
|
||||
|
||||
private String codePostal;
|
||||
|
||||
private String ville;
|
||||
|
||||
private String departement;
|
||||
|
||||
private String region;
|
||||
|
||||
private List<String> zonesIntervention;
|
||||
|
||||
private String siteWeb;
|
||||
|
||||
private String emailContact;
|
||||
|
||||
private String telephoneCommercial;
|
||||
|
||||
private String logoUrl;
|
||||
|
||||
private List<String> photosRealisations;
|
||||
|
||||
private BigDecimal noteGlobale;
|
||||
|
||||
private Integer nombreAvis;
|
||||
|
||||
private Integer nombreProjetsRealises;
|
||||
|
||||
private Integer nombreClientsServis;
|
||||
|
||||
private Boolean visible;
|
||||
|
||||
private Boolean certifie;
|
||||
|
||||
private TypeAbonnement typeAbonnement;
|
||||
|
||||
private LocalDateTime finAbonnement;
|
||||
|
||||
private BigDecimal budgetMinProjet;
|
||||
|
||||
private BigDecimal budgetMaxProjet;
|
||||
|
||||
private Boolean accepteUrgences;
|
||||
|
||||
private Boolean accepteWeekends;
|
||||
|
||||
private Integer delaiMoyenIntervention;
|
||||
|
||||
private BigDecimal chiffresAffairesAnnuel;
|
||||
|
||||
private String garantiesProposees;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,112 +1,112 @@
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.TypeAbonnement;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la réponse d'un profil d'entreprise - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class EntrepriseProfileResponseDTO {
|
||||
|
||||
private UUID id;
|
||||
|
||||
private String nomCommercial;
|
||||
|
||||
private String description;
|
||||
|
||||
private String slogan;
|
||||
|
||||
private List<String> specialites;
|
||||
|
||||
private List<String> certifications;
|
||||
|
||||
private String adresseComplete;
|
||||
|
||||
private String codePostal;
|
||||
|
||||
private String ville;
|
||||
|
||||
private String departement;
|
||||
|
||||
private String region;
|
||||
|
||||
private List<String> zonesIntervention;
|
||||
|
||||
private String siteWeb;
|
||||
|
||||
private String emailContact;
|
||||
|
||||
private String telephoneCommercial;
|
||||
|
||||
private String logoUrl;
|
||||
|
||||
private List<String> photosRealisations;
|
||||
|
||||
private BigDecimal noteGlobale;
|
||||
|
||||
private Integer nombreAvis;
|
||||
|
||||
private Integer nombreProjetsRealises;
|
||||
|
||||
private Integer nombreClientsServis;
|
||||
|
||||
private Boolean visible;
|
||||
|
||||
private Boolean certifie;
|
||||
|
||||
private TypeAbonnement typeAbonnement;
|
||||
|
||||
private LocalDateTime finAbonnement;
|
||||
|
||||
private BigDecimal budgetMinProjet;
|
||||
|
||||
private BigDecimal budgetMaxProjet;
|
||||
|
||||
private Boolean accepteUrgences;
|
||||
|
||||
private Boolean accepteWeekends;
|
||||
|
||||
private Integer delaiMoyenIntervention;
|
||||
|
||||
private BigDecimal chiffresAffairesAnnuel;
|
||||
|
||||
private String garantiesProposees;
|
||||
|
||||
private LocalDateTime dateCreation;
|
||||
|
||||
private LocalDateTime dateModification;
|
||||
|
||||
private LocalDateTime derniereMiseAJour;
|
||||
|
||||
private LocalDateTime derniereActivite;
|
||||
|
||||
// Relations simplifiées
|
||||
private UUID proprietaireId;
|
||||
private String proprietaireNom;
|
||||
private String proprietaireEmail;
|
||||
|
||||
// Métadonnées calculées
|
||||
private Boolean isAbonnementActif;
|
||||
|
||||
private Boolean isPremium;
|
||||
|
||||
private Boolean isEnterprise;
|
||||
|
||||
private Double scoreVisibilite;
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.TypeAbonnement;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la réponse d'un profil d'entreprise - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class EntrepriseProfileResponseDTO {
|
||||
|
||||
private UUID id;
|
||||
|
||||
private String nomCommercial;
|
||||
|
||||
private String description;
|
||||
|
||||
private String slogan;
|
||||
|
||||
private List<String> specialites;
|
||||
|
||||
private List<String> certifications;
|
||||
|
||||
private String adresseComplete;
|
||||
|
||||
private String codePostal;
|
||||
|
||||
private String ville;
|
||||
|
||||
private String departement;
|
||||
|
||||
private String region;
|
||||
|
||||
private List<String> zonesIntervention;
|
||||
|
||||
private String siteWeb;
|
||||
|
||||
private String emailContact;
|
||||
|
||||
private String telephoneCommercial;
|
||||
|
||||
private String logoUrl;
|
||||
|
||||
private List<String> photosRealisations;
|
||||
|
||||
private BigDecimal noteGlobale;
|
||||
|
||||
private Integer nombreAvis;
|
||||
|
||||
private Integer nombreProjetsRealises;
|
||||
|
||||
private Integer nombreClientsServis;
|
||||
|
||||
private Boolean visible;
|
||||
|
||||
private Boolean certifie;
|
||||
|
||||
private TypeAbonnement typeAbonnement;
|
||||
|
||||
private LocalDateTime finAbonnement;
|
||||
|
||||
private BigDecimal budgetMinProjet;
|
||||
|
||||
private BigDecimal budgetMaxProjet;
|
||||
|
||||
private Boolean accepteUrgences;
|
||||
|
||||
private Boolean accepteWeekends;
|
||||
|
||||
private Integer delaiMoyenIntervention;
|
||||
|
||||
private BigDecimal chiffresAffairesAnnuel;
|
||||
|
||||
private String garantiesProposees;
|
||||
|
||||
private LocalDateTime dateCreation;
|
||||
|
||||
private LocalDateTime dateModification;
|
||||
|
||||
private LocalDateTime derniereMiseAJour;
|
||||
|
||||
private LocalDateTime derniereActivite;
|
||||
|
||||
// Relations simplifiées
|
||||
private UUID proprietaireId;
|
||||
private String proprietaireNom;
|
||||
private String proprietaireEmail;
|
||||
|
||||
// Métadonnées calculées
|
||||
private Boolean isAbonnementActif;
|
||||
|
||||
private Boolean isPremium;
|
||||
|
||||
private Boolean isEnterprise;
|
||||
|
||||
private Double scoreVisibilite;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,42 +1,42 @@
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.StatutEquipe;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la création d'une équipe - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class EquipeCreateDTO {
|
||||
|
||||
@NotBlank(message = "Le nom est obligatoire")
|
||||
private String nom;
|
||||
|
||||
private String description;
|
||||
|
||||
@NotNull(message = "Le chef d'équipe est obligatoire")
|
||||
private UUID chefId;
|
||||
|
||||
private String specialite;
|
||||
|
||||
private List<String> specialites;
|
||||
|
||||
private StatutEquipe statut;
|
||||
|
||||
private Boolean actif;
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.StatutEquipe;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la création d'une équipe - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class EquipeCreateDTO {
|
||||
|
||||
@NotBlank(message = "Le nom est obligatoire")
|
||||
private String nom;
|
||||
|
||||
private String description;
|
||||
|
||||
@NotNull(message = "Le chef d'équipe est obligatoire")
|
||||
private UUID chefId;
|
||||
|
||||
private String specialite;
|
||||
|
||||
private List<String> specialites;
|
||||
|
||||
private StatutEquipe statut;
|
||||
|
||||
private Boolean actif;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,56 +1,56 @@
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.StatutEquipe;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la réponse d'une équipe - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class EquipeResponseDTO {
|
||||
|
||||
private UUID id;
|
||||
|
||||
private String nom;
|
||||
|
||||
private String description;
|
||||
|
||||
private StatutEquipe statut;
|
||||
|
||||
private String specialite;
|
||||
|
||||
private List<String> specialites;
|
||||
|
||||
private Boolean actif;
|
||||
|
||||
private LocalDateTime dateCreation;
|
||||
|
||||
private LocalDateTime dateModification;
|
||||
|
||||
// Relations simplifiées
|
||||
private UUID chefId;
|
||||
private String chefNom;
|
||||
private String chefPrenom;
|
||||
|
||||
private Integer nombreMembres;
|
||||
|
||||
private List<UUID> membreIds;
|
||||
|
||||
private Integer nombreChantiers;
|
||||
|
||||
private List<UUID> chantierIds;
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.StatutEquipe;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la réponse d'une équipe - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class EquipeResponseDTO {
|
||||
|
||||
private UUID id;
|
||||
|
||||
private String nom;
|
||||
|
||||
private String description;
|
||||
|
||||
private StatutEquipe statut;
|
||||
|
||||
private String specialite;
|
||||
|
||||
private List<String> specialites;
|
||||
|
||||
private Boolean actif;
|
||||
|
||||
private LocalDateTime dateCreation;
|
||||
|
||||
private LocalDateTime dateModification;
|
||||
|
||||
// Relations simplifiées
|
||||
private UUID chefId;
|
||||
private String chefNom;
|
||||
private String chefPrenom;
|
||||
|
||||
private Integer nombreMembres;
|
||||
|
||||
private List<UUID> membreIds;
|
||||
|
||||
private Integer nombreChantiers;
|
||||
|
||||
private List<UUID> chantierIds;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,114 +1,114 @@
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.Facture.StatutFacture;
|
||||
import dev.lions.btpxpress.domain.core.entity.Facture.TypeFacture;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Positive;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la création de facture - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class FactureCreateDTO {
|
||||
|
||||
@NotBlank(message = "Le numéro de facture est obligatoire")
|
||||
private String numero;
|
||||
|
||||
@NotBlank(message = "L'objet de la facture est obligatoire")
|
||||
private String objet;
|
||||
|
||||
private String description;
|
||||
|
||||
@NotNull(message = "La date d'émission est obligatoire")
|
||||
private LocalDate dateEmission;
|
||||
|
||||
@NotNull(message = "La date d'échéance est obligatoire")
|
||||
private LocalDate dateEcheance;
|
||||
|
||||
private LocalDate datePaiement;
|
||||
|
||||
@Builder.Default
|
||||
private StatutFacture statut = StatutFacture.BROUILLON;
|
||||
|
||||
@Positive(message = "Le montant HT doit être positif")
|
||||
private BigDecimal montantHT;
|
||||
|
||||
@Builder.Default
|
||||
private BigDecimal tauxTVA = BigDecimal.valueOf(20.0);
|
||||
|
||||
private BigDecimal montantPaye;
|
||||
|
||||
private String conditionsPaiement;
|
||||
|
||||
@Builder.Default
|
||||
private TypeFacture typeFacture = TypeFacture.FACTURE;
|
||||
|
||||
@NotNull(message = "Le client est obligatoire")
|
||||
private UUID clientId;
|
||||
|
||||
private UUID chantierId; // Optionnel
|
||||
|
||||
private UUID devisId; // Optionnel (si facture issue d'un devis)
|
||||
|
||||
private List<LigneFactureCreateDTO> lignes;
|
||||
|
||||
/** Méthode de conversion String vers UUID pour clientId */
|
||||
public void setClientId(String clientId) {
|
||||
if (clientId != null && !clientId.trim().isEmpty()) {
|
||||
this.clientId = UUID.fromString(clientId);
|
||||
}
|
||||
}
|
||||
|
||||
/** Méthode de conversion String vers UUID pour chantierId */
|
||||
public void setChantierId(String chantierId) {
|
||||
if (chantierId != null && !chantierId.trim().isEmpty()) {
|
||||
this.chantierId = UUID.fromString(chantierId);
|
||||
}
|
||||
}
|
||||
|
||||
/** Méthode de conversion String vers UUID pour devisId */
|
||||
public void setDevisId(String devisId) {
|
||||
if (devisId != null && !devisId.trim().isEmpty()) {
|
||||
this.devisId = UUID.fromString(devisId);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* DTO pour une ligne de facture
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class LigneFactureCreateDTO {
|
||||
@NotBlank(message = "La description de la ligne est obligatoire")
|
||||
private String description;
|
||||
|
||||
@Positive(message = "La quantité doit être positive")
|
||||
private BigDecimal quantite;
|
||||
|
||||
@Positive(message = "Le prix unitaire doit être positif")
|
||||
private BigDecimal prixUnitaire;
|
||||
|
||||
private BigDecimal tauxTVA;
|
||||
|
||||
private String unite;
|
||||
}
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.Facture.StatutFacture;
|
||||
import dev.lions.btpxpress.domain.core.entity.Facture.TypeFacture;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Positive;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la création de facture - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class FactureCreateDTO {
|
||||
|
||||
@NotBlank(message = "Le numéro de facture est obligatoire")
|
||||
private String numero;
|
||||
|
||||
@NotBlank(message = "L'objet de la facture est obligatoire")
|
||||
private String objet;
|
||||
|
||||
private String description;
|
||||
|
||||
@NotNull(message = "La date d'émission est obligatoire")
|
||||
private LocalDate dateEmission;
|
||||
|
||||
@NotNull(message = "La date d'échéance est obligatoire")
|
||||
private LocalDate dateEcheance;
|
||||
|
||||
private LocalDate datePaiement;
|
||||
|
||||
@Builder.Default
|
||||
private StatutFacture statut = StatutFacture.BROUILLON;
|
||||
|
||||
@Positive(message = "Le montant HT doit être positif")
|
||||
private BigDecimal montantHT;
|
||||
|
||||
@Builder.Default
|
||||
private BigDecimal tauxTVA = BigDecimal.valueOf(20.0);
|
||||
|
||||
private BigDecimal montantPaye;
|
||||
|
||||
private String conditionsPaiement;
|
||||
|
||||
@Builder.Default
|
||||
private TypeFacture typeFacture = TypeFacture.FACTURE;
|
||||
|
||||
@NotNull(message = "Le client est obligatoire")
|
||||
private UUID clientId;
|
||||
|
||||
private UUID chantierId; // Optionnel
|
||||
|
||||
private UUID devisId; // Optionnel (si facture issue d'un devis)
|
||||
|
||||
private List<LigneFactureCreateDTO> lignes;
|
||||
|
||||
/** Méthode de conversion String vers UUID pour clientId */
|
||||
public void setClientId(String clientId) {
|
||||
if (clientId != null && !clientId.trim().isEmpty()) {
|
||||
this.clientId = UUID.fromString(clientId);
|
||||
}
|
||||
}
|
||||
|
||||
/** Méthode de conversion String vers UUID pour chantierId */
|
||||
public void setChantierId(String chantierId) {
|
||||
if (chantierId != null && !chantierId.trim().isEmpty()) {
|
||||
this.chantierId = UUID.fromString(chantierId);
|
||||
}
|
||||
}
|
||||
|
||||
/** Méthode de conversion String vers UUID pour devisId */
|
||||
public void setDevisId(String devisId) {
|
||||
if (devisId != null && !devisId.trim().isEmpty()) {
|
||||
this.devisId = UUID.fromString(devisId);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* DTO pour une ligne de facture
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class LigneFactureCreateDTO {
|
||||
@NotBlank(message = "La description de la ligne est obligatoire")
|
||||
private String description;
|
||||
|
||||
@Positive(message = "La quantité doit être positive")
|
||||
private BigDecimal quantite;
|
||||
|
||||
@Positive(message = "Le prix unitaire doit être positif")
|
||||
private BigDecimal prixUnitaire;
|
||||
|
||||
private BigDecimal tauxTVA;
|
||||
|
||||
private String unite;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,99 +1,99 @@
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.Facture.StatutFacture;
|
||||
import dev.lions.btpxpress.domain.core.entity.Facture.TypeFacture;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la réponse d'une facture - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class FactureResponseDTO {
|
||||
|
||||
private UUID id;
|
||||
|
||||
private String numero;
|
||||
|
||||
private String objet;
|
||||
|
||||
private String description;
|
||||
|
||||
private LocalDate dateEmission;
|
||||
|
||||
private LocalDate dateEcheance;
|
||||
|
||||
private LocalDate datePaiement;
|
||||
|
||||
private StatutFacture statut;
|
||||
|
||||
private BigDecimal montantHT;
|
||||
|
||||
private BigDecimal tauxTVA;
|
||||
|
||||
private BigDecimal montantTVA;
|
||||
|
||||
private BigDecimal montantTTC;
|
||||
|
||||
private BigDecimal montantPaye;
|
||||
|
||||
private BigDecimal montantRestant;
|
||||
|
||||
private String conditionsPaiement;
|
||||
|
||||
private TypeFacture typeFacture;
|
||||
|
||||
private Boolean actif;
|
||||
|
||||
private LocalDateTime dateCreation;
|
||||
|
||||
private LocalDateTime dateModification;
|
||||
|
||||
// Relations simplifiées
|
||||
private UUID clientId;
|
||||
private String clientNom;
|
||||
private String clientRaisonSociale;
|
||||
|
||||
private UUID chantierId;
|
||||
private String chantierNom;
|
||||
|
||||
private UUID devisId;
|
||||
private String devisNumero;
|
||||
|
||||
private List<LigneFactureResponseDTO> lignes;
|
||||
|
||||
/**
|
||||
* DTO pour une ligne de facture en réponse
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class LigneFactureResponseDTO {
|
||||
private UUID id;
|
||||
private String description;
|
||||
private BigDecimal quantite;
|
||||
private BigDecimal prixUnitaire;
|
||||
private BigDecimal tauxTVA;
|
||||
private BigDecimal montantHT;
|
||||
private BigDecimal montantTVA;
|
||||
private BigDecimal montantTTC;
|
||||
private String unite;
|
||||
private Integer ordre;
|
||||
}
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.Facture.StatutFacture;
|
||||
import dev.lions.btpxpress.domain.core.entity.Facture.TypeFacture;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la réponse d'une facture - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class FactureResponseDTO {
|
||||
|
||||
private UUID id;
|
||||
|
||||
private String numero;
|
||||
|
||||
private String objet;
|
||||
|
||||
private String description;
|
||||
|
||||
private LocalDate dateEmission;
|
||||
|
||||
private LocalDate dateEcheance;
|
||||
|
||||
private LocalDate datePaiement;
|
||||
|
||||
private StatutFacture statut;
|
||||
|
||||
private BigDecimal montantHT;
|
||||
|
||||
private BigDecimal tauxTVA;
|
||||
|
||||
private BigDecimal montantTVA;
|
||||
|
||||
private BigDecimal montantTTC;
|
||||
|
||||
private BigDecimal montantPaye;
|
||||
|
||||
private BigDecimal montantRestant;
|
||||
|
||||
private String conditionsPaiement;
|
||||
|
||||
private TypeFacture typeFacture;
|
||||
|
||||
private Boolean actif;
|
||||
|
||||
private LocalDateTime dateCreation;
|
||||
|
||||
private LocalDateTime dateModification;
|
||||
|
||||
// Relations simplifiées
|
||||
private UUID clientId;
|
||||
private String clientNom;
|
||||
private String clientRaisonSociale;
|
||||
|
||||
private UUID chantierId;
|
||||
private String chantierNom;
|
||||
|
||||
private UUID devisId;
|
||||
private String devisNumero;
|
||||
|
||||
private List<LigneFactureResponseDTO> lignes;
|
||||
|
||||
/**
|
||||
* DTO pour une ligne de facture en réponse
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class LigneFactureResponseDTO {
|
||||
private UUID id;
|
||||
private String description;
|
||||
private BigDecimal quantite;
|
||||
private BigDecimal prixUnitaire;
|
||||
private BigDecimal tauxTVA;
|
||||
private BigDecimal montantHT;
|
||||
private BigDecimal montantTVA;
|
||||
private BigDecimal montantTTC;
|
||||
private String unite;
|
||||
private Integer ordre;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,68 +1,68 @@
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import jakarta.validation.constraints.Email;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la création d'un fournisseur - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class FournisseurCreateDTO {
|
||||
|
||||
@NotBlank(message = "Le nom est obligatoire")
|
||||
@Size(max = 255)
|
||||
private String nom;
|
||||
|
||||
@NotBlank(message = "Le contact est obligatoire")
|
||||
@Size(max = 255)
|
||||
private String contact;
|
||||
|
||||
@Size(max = 20)
|
||||
private String telephone;
|
||||
|
||||
@NotBlank(message = "L'email est obligatoire")
|
||||
@Email
|
||||
@Size(max = 255)
|
||||
private String email;
|
||||
|
||||
@Size(max = 500)
|
||||
private String adresse;
|
||||
|
||||
@Size(max = 100)
|
||||
private String ville;
|
||||
|
||||
@Size(max = 10)
|
||||
private String codePostal;
|
||||
|
||||
@Size(max = 100)
|
||||
private String pays;
|
||||
|
||||
@Size(max = 14)
|
||||
private String siret;
|
||||
|
||||
@Size(max = 20)
|
||||
private String tva;
|
||||
|
||||
@Size(max = 100)
|
||||
private String conditionsPaiement;
|
||||
|
||||
private Integer delaiLivraison;
|
||||
|
||||
@Size(max = 1000)
|
||||
private String note;
|
||||
|
||||
private Boolean actif;
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import jakarta.validation.constraints.Email;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la création d'un fournisseur - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class FournisseurCreateDTO {
|
||||
|
||||
@NotBlank(message = "Le nom est obligatoire")
|
||||
@Size(max = 255)
|
||||
private String nom;
|
||||
|
||||
@NotBlank(message = "Le contact est obligatoire")
|
||||
@Size(max = 255)
|
||||
private String contact;
|
||||
|
||||
@Size(max = 20)
|
||||
private String telephone;
|
||||
|
||||
@NotBlank(message = "L'email est obligatoire")
|
||||
@Email
|
||||
@Size(max = 255)
|
||||
private String email;
|
||||
|
||||
@Size(max = 500)
|
||||
private String adresse;
|
||||
|
||||
@Size(max = 100)
|
||||
private String ville;
|
||||
|
||||
@Size(max = 10)
|
||||
private String codePostal;
|
||||
|
||||
@Size(max = 100)
|
||||
private String pays;
|
||||
|
||||
@Size(max = 14)
|
||||
private String siret;
|
||||
|
||||
@Size(max = 20)
|
||||
private String tva;
|
||||
|
||||
@Size(max = 100)
|
||||
private String conditionsPaiement;
|
||||
|
||||
private Integer delaiLivraison;
|
||||
|
||||
@Size(max = 1000)
|
||||
private String note;
|
||||
|
||||
private Boolean actif;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,62 +1,62 @@
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la réponse d'un fournisseur - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class FournisseurResponseDTO {
|
||||
|
||||
private UUID id;
|
||||
|
||||
private String nom;
|
||||
|
||||
private String contact;
|
||||
|
||||
private String telephone;
|
||||
|
||||
private String email;
|
||||
|
||||
private String adresse;
|
||||
|
||||
private String ville;
|
||||
|
||||
private String codePostal;
|
||||
|
||||
private String pays;
|
||||
|
||||
private String siret;
|
||||
|
||||
private String tva;
|
||||
|
||||
private String conditionsPaiement;
|
||||
|
||||
private Integer delaiLivraison;
|
||||
|
||||
private String note;
|
||||
|
||||
private Boolean actif;
|
||||
|
||||
private LocalDateTime dateCreation;
|
||||
|
||||
private LocalDateTime dateModification;
|
||||
|
||||
// Métadonnées calculées
|
||||
private String resume;
|
||||
|
||||
private Boolean complet;
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la réponse d'un fournisseur - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class FournisseurResponseDTO {
|
||||
|
||||
private UUID id;
|
||||
|
||||
private String nom;
|
||||
|
||||
private String contact;
|
||||
|
||||
private String telephone;
|
||||
|
||||
private String email;
|
||||
|
||||
private String adresse;
|
||||
|
||||
private String ville;
|
||||
|
||||
private String codePostal;
|
||||
|
||||
private String pays;
|
||||
|
||||
private String siret;
|
||||
|
||||
private String tva;
|
||||
|
||||
private String conditionsPaiement;
|
||||
|
||||
private Integer delaiLivraison;
|
||||
|
||||
private String note;
|
||||
|
||||
private Boolean actif;
|
||||
|
||||
private LocalDateTime dateCreation;
|
||||
|
||||
private LocalDateTime dateModification;
|
||||
|
||||
// Métadonnées calculées
|
||||
private String resume;
|
||||
|
||||
private Boolean complet;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,91 +1,91 @@
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.StatutLivraison;
|
||||
import dev.lions.btpxpress.domain.core.entity.TypeTransport;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalTime;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la création d'une livraison de matériel - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class LivraisonMaterielCreateDTO {
|
||||
|
||||
@NotNull(message = "La réservation est obligatoire")
|
||||
private UUID reservationId;
|
||||
|
||||
private UUID chantierDestinationId;
|
||||
|
||||
@NotBlank(message = "Le numéro de livraison est obligatoire")
|
||||
private String numeroLivraison;
|
||||
|
||||
private String referenceCommande;
|
||||
|
||||
@NotNull(message = "Le type de transport est obligatoire")
|
||||
private TypeTransport typeTransport;
|
||||
|
||||
private StatutLivraison statut;
|
||||
|
||||
@NotNull(message = "La date de livraison prévue est obligatoire")
|
||||
private LocalDate dateLivraisonPrevue;
|
||||
|
||||
private LocalTime heureLivraisonPrevue;
|
||||
|
||||
private Integer dureePrevueMinutes;
|
||||
|
||||
private String transporteur;
|
||||
|
||||
private String chauffeur;
|
||||
|
||||
private String telephoneChauffeur;
|
||||
|
||||
private String immatriculation;
|
||||
|
||||
private BigDecimal poidsChargeKg;
|
||||
|
||||
private BigDecimal volumeChargeM3;
|
||||
|
||||
private String adresseDepart;
|
||||
|
||||
private BigDecimal latitudeDepart;
|
||||
|
||||
private BigDecimal longitudeDepart;
|
||||
|
||||
private String adresseDestination;
|
||||
|
||||
private BigDecimal latitudeDestination;
|
||||
|
||||
private BigDecimal longitudeDestination;
|
||||
|
||||
private BigDecimal distanceKm;
|
||||
|
||||
private Integer dureeTrajetPrevueMinutes;
|
||||
|
||||
private String contactReception;
|
||||
|
||||
private String telephoneContact;
|
||||
|
||||
private String instructionsSpeciales;
|
||||
|
||||
private String accesChantier;
|
||||
|
||||
private LocalTime heureDepartPrevue;
|
||||
|
||||
private LocalTime heureArriveePrevue;
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.StatutLivraison;
|
||||
import dev.lions.btpxpress.domain.core.entity.TypeTransport;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalTime;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la création d'une livraison de matériel - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class LivraisonMaterielCreateDTO {
|
||||
|
||||
@NotNull(message = "La réservation est obligatoire")
|
||||
private UUID reservationId;
|
||||
|
||||
private UUID chantierDestinationId;
|
||||
|
||||
@NotBlank(message = "Le numéro de livraison est obligatoire")
|
||||
private String numeroLivraison;
|
||||
|
||||
private String referenceCommande;
|
||||
|
||||
@NotNull(message = "Le type de transport est obligatoire")
|
||||
private TypeTransport typeTransport;
|
||||
|
||||
private StatutLivraison statut;
|
||||
|
||||
@NotNull(message = "La date de livraison prévue est obligatoire")
|
||||
private LocalDate dateLivraisonPrevue;
|
||||
|
||||
private LocalTime heureLivraisonPrevue;
|
||||
|
||||
private Integer dureePrevueMinutes;
|
||||
|
||||
private String transporteur;
|
||||
|
||||
private String chauffeur;
|
||||
|
||||
private String telephoneChauffeur;
|
||||
|
||||
private String immatriculation;
|
||||
|
||||
private BigDecimal poidsChargeKg;
|
||||
|
||||
private BigDecimal volumeChargeM3;
|
||||
|
||||
private String adresseDepart;
|
||||
|
||||
private BigDecimal latitudeDepart;
|
||||
|
||||
private BigDecimal longitudeDepart;
|
||||
|
||||
private String adresseDestination;
|
||||
|
||||
private BigDecimal latitudeDestination;
|
||||
|
||||
private BigDecimal longitudeDestination;
|
||||
|
||||
private BigDecimal distanceKm;
|
||||
|
||||
private Integer dureeTrajetPrevueMinutes;
|
||||
|
||||
private String contactReception;
|
||||
|
||||
private String telephoneContact;
|
||||
|
||||
private String instructionsSpeciales;
|
||||
|
||||
private String accesChantier;
|
||||
|
||||
private LocalTime heureDepartPrevue;
|
||||
|
||||
private LocalTime heureArriveePrevue;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,188 +1,188 @@
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.StatutLivraison;
|
||||
import dev.lions.btpxpress.domain.core.entity.TypeTransport;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la réponse d'une livraison de matériel - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class LivraisonMaterielResponseDTO {
|
||||
|
||||
private UUID id;
|
||||
|
||||
private String numeroLivraison;
|
||||
|
||||
private String referenceCommande;
|
||||
|
||||
private TypeTransport typeTransport;
|
||||
|
||||
private StatutLivraison statut;
|
||||
|
||||
private LocalDate dateLivraisonPrevue;
|
||||
|
||||
private LocalTime heureLivraisonPrevue;
|
||||
|
||||
private LocalDate dateLivraisonReelle;
|
||||
|
||||
private LocalTime heureLivraisonReelle;
|
||||
|
||||
private Integer dureePrevueMinutes;
|
||||
|
||||
private Integer dureeReelleMinutes;
|
||||
|
||||
private String transporteur;
|
||||
|
||||
private String chauffeur;
|
||||
|
||||
private String telephoneChauffeur;
|
||||
|
||||
private String immatriculation;
|
||||
|
||||
private BigDecimal poidsChargeKg;
|
||||
|
||||
private BigDecimal volumeChargeM3;
|
||||
|
||||
private String adresseDepart;
|
||||
|
||||
private BigDecimal latitudeDepart;
|
||||
|
||||
private BigDecimal longitudeDepart;
|
||||
|
||||
private String adresseDestination;
|
||||
|
||||
private BigDecimal latitudeDestination;
|
||||
|
||||
private BigDecimal longitudeDestination;
|
||||
|
||||
private BigDecimal distanceKm;
|
||||
|
||||
private Integer dureeTrajetPrevueMinutes;
|
||||
|
||||
private Integer dureeTrajetReelleMinutes;
|
||||
|
||||
private String contactReception;
|
||||
|
||||
private String telephoneContact;
|
||||
|
||||
private String instructionsSpeciales;
|
||||
|
||||
private String accesChantier;
|
||||
|
||||
private LocalTime heureDepartPrevue;
|
||||
|
||||
private LocalTime heureDepartReelle;
|
||||
|
||||
private LocalTime heureArriveePrevue;
|
||||
|
||||
private LocalTime heureArriveeReelle;
|
||||
|
||||
private Integer tempsChargementMinutes;
|
||||
|
||||
private Integer tempsDechargementMinutes;
|
||||
|
||||
private String etatMaterielDepart;
|
||||
|
||||
private String etatMaterielArrivee;
|
||||
|
||||
private BigDecimal quantiteLivree;
|
||||
|
||||
private BigDecimal quantiteCommandee;
|
||||
|
||||
private Boolean conformiteLivraison;
|
||||
|
||||
private String observationsChauffeur;
|
||||
|
||||
private String observationsReceptionnaire;
|
||||
|
||||
private String signatureReceptionnaire;
|
||||
|
||||
private String photoLivraison;
|
||||
|
||||
private BigDecimal coutTransport;
|
||||
|
||||
private BigDecimal coutCarburant;
|
||||
|
||||
private BigDecimal coutPeages;
|
||||
|
||||
private BigDecimal coutTotal;
|
||||
|
||||
private String facture;
|
||||
|
||||
private Boolean incidentDetecte;
|
||||
|
||||
private String typeIncident;
|
||||
|
||||
private String descriptionIncident;
|
||||
|
||||
private String impactIncident;
|
||||
|
||||
private String actionsCorrectives;
|
||||
|
||||
private Boolean trackingActive;
|
||||
|
||||
private BigDecimal dernierePositionLat;
|
||||
|
||||
private BigDecimal dernierePositionLng;
|
||||
|
||||
private LocalDateTime derniereMiseAJourGps;
|
||||
|
||||
private Integer vitesseActuelleKmh;
|
||||
|
||||
private LocalDateTime dateCreation;
|
||||
|
||||
private LocalDateTime dateModification;
|
||||
|
||||
private String planificateur;
|
||||
|
||||
private String derniereModificationPar;
|
||||
|
||||
private Boolean actif;
|
||||
|
||||
// Relations simplifiées
|
||||
private UUID reservationId;
|
||||
private String reservationReference;
|
||||
|
||||
private UUID chantierDestinationId;
|
||||
private String chantierDestinationNom;
|
||||
|
||||
// Métadonnées calculées
|
||||
private Integer dureeTotalePrevueMinutes;
|
||||
|
||||
private Integer dureeTotaleReelleMinutes;
|
||||
|
||||
private Integer retardMinutes;
|
||||
|
||||
private Boolean estEnRetard;
|
||||
|
||||
private Boolean estConforme;
|
||||
|
||||
private Double vitesseMoyenneKmh;
|
||||
|
||||
private Boolean isTrackingDisponible;
|
||||
|
||||
private Double distanceVersDestination;
|
||||
|
||||
private LocalTime heureArriveeEstimee;
|
||||
|
||||
private Boolean necessiteManutention;
|
||||
|
||||
private Integer priorite;
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.StatutLivraison;
|
||||
import dev.lions.btpxpress.domain.core.entity.TypeTransport;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la réponse d'une livraison de matériel - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class LivraisonMaterielResponseDTO {
|
||||
|
||||
private UUID id;
|
||||
|
||||
private String numeroLivraison;
|
||||
|
||||
private String referenceCommande;
|
||||
|
||||
private TypeTransport typeTransport;
|
||||
|
||||
private StatutLivraison statut;
|
||||
|
||||
private LocalDate dateLivraisonPrevue;
|
||||
|
||||
private LocalTime heureLivraisonPrevue;
|
||||
|
||||
private LocalDate dateLivraisonReelle;
|
||||
|
||||
private LocalTime heureLivraisonReelle;
|
||||
|
||||
private Integer dureePrevueMinutes;
|
||||
|
||||
private Integer dureeReelleMinutes;
|
||||
|
||||
private String transporteur;
|
||||
|
||||
private String chauffeur;
|
||||
|
||||
private String telephoneChauffeur;
|
||||
|
||||
private String immatriculation;
|
||||
|
||||
private BigDecimal poidsChargeKg;
|
||||
|
||||
private BigDecimal volumeChargeM3;
|
||||
|
||||
private String adresseDepart;
|
||||
|
||||
private BigDecimal latitudeDepart;
|
||||
|
||||
private BigDecimal longitudeDepart;
|
||||
|
||||
private String adresseDestination;
|
||||
|
||||
private BigDecimal latitudeDestination;
|
||||
|
||||
private BigDecimal longitudeDestination;
|
||||
|
||||
private BigDecimal distanceKm;
|
||||
|
||||
private Integer dureeTrajetPrevueMinutes;
|
||||
|
||||
private Integer dureeTrajetReelleMinutes;
|
||||
|
||||
private String contactReception;
|
||||
|
||||
private String telephoneContact;
|
||||
|
||||
private String instructionsSpeciales;
|
||||
|
||||
private String accesChantier;
|
||||
|
||||
private LocalTime heureDepartPrevue;
|
||||
|
||||
private LocalTime heureDepartReelle;
|
||||
|
||||
private LocalTime heureArriveePrevue;
|
||||
|
||||
private LocalTime heureArriveeReelle;
|
||||
|
||||
private Integer tempsChargementMinutes;
|
||||
|
||||
private Integer tempsDechargementMinutes;
|
||||
|
||||
private String etatMaterielDepart;
|
||||
|
||||
private String etatMaterielArrivee;
|
||||
|
||||
private BigDecimal quantiteLivree;
|
||||
|
||||
private BigDecimal quantiteCommandee;
|
||||
|
||||
private Boolean conformiteLivraison;
|
||||
|
||||
private String observationsChauffeur;
|
||||
|
||||
private String observationsReceptionnaire;
|
||||
|
||||
private String signatureReceptionnaire;
|
||||
|
||||
private String photoLivraison;
|
||||
|
||||
private BigDecimal coutTransport;
|
||||
|
||||
private BigDecimal coutCarburant;
|
||||
|
||||
private BigDecimal coutPeages;
|
||||
|
||||
private BigDecimal coutTotal;
|
||||
|
||||
private String facture;
|
||||
|
||||
private Boolean incidentDetecte;
|
||||
|
||||
private String typeIncident;
|
||||
|
||||
private String descriptionIncident;
|
||||
|
||||
private String impactIncident;
|
||||
|
||||
private String actionsCorrectives;
|
||||
|
||||
private Boolean trackingActive;
|
||||
|
||||
private BigDecimal dernierePositionLat;
|
||||
|
||||
private BigDecimal dernierePositionLng;
|
||||
|
||||
private LocalDateTime derniereMiseAJourGps;
|
||||
|
||||
private Integer vitesseActuelleKmh;
|
||||
|
||||
private LocalDateTime dateCreation;
|
||||
|
||||
private LocalDateTime dateModification;
|
||||
|
||||
private String planificateur;
|
||||
|
||||
private String derniereModificationPar;
|
||||
|
||||
private Boolean actif;
|
||||
|
||||
// Relations simplifiées
|
||||
private UUID reservationId;
|
||||
private String reservationReference;
|
||||
|
||||
private UUID chantierDestinationId;
|
||||
private String chantierDestinationNom;
|
||||
|
||||
// Métadonnées calculées
|
||||
private Integer dureeTotalePrevueMinutes;
|
||||
|
||||
private Integer dureeTotaleReelleMinutes;
|
||||
|
||||
private Integer retardMinutes;
|
||||
|
||||
private Boolean estEnRetard;
|
||||
|
||||
private Boolean estConforme;
|
||||
|
||||
private Double vitesseMoyenneKmh;
|
||||
|
||||
private Boolean isTrackingDisponible;
|
||||
|
||||
private Double distanceVersDestination;
|
||||
|
||||
private LocalTime heureArriveeEstimee;
|
||||
|
||||
private Boolean necessiteManutention;
|
||||
|
||||
private Integer priorite;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,52 +1,52 @@
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.StatutMaintenance;
|
||||
import dev.lions.btpxpress.domain.core.entity.TypeMaintenance;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la création d'une maintenance - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class MaintenanceCreateDTO {
|
||||
|
||||
@NotNull(message = "Le matériel est obligatoire")
|
||||
private UUID materielId;
|
||||
|
||||
@NotNull(message = "Le type de maintenance est obligatoire")
|
||||
private TypeMaintenance type;
|
||||
|
||||
@NotBlank(message = "La description est obligatoire")
|
||||
private String description;
|
||||
|
||||
@NotNull(message = "La date prévue est obligatoire")
|
||||
private LocalDate datePrevue;
|
||||
|
||||
private LocalDate dateRealisee;
|
||||
|
||||
private BigDecimal cout;
|
||||
|
||||
private StatutMaintenance statut;
|
||||
|
||||
private String technicien;
|
||||
|
||||
private String notes;
|
||||
|
||||
private LocalDate prochaineMaintenance;
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.StatutMaintenance;
|
||||
import dev.lions.btpxpress.domain.core.entity.TypeMaintenance;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la création d'une maintenance - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class MaintenanceCreateDTO {
|
||||
|
||||
@NotNull(message = "Le matériel est obligatoire")
|
||||
private UUID materielId;
|
||||
|
||||
@NotNull(message = "Le type de maintenance est obligatoire")
|
||||
private TypeMaintenance type;
|
||||
|
||||
@NotBlank(message = "La description est obligatoire")
|
||||
private String description;
|
||||
|
||||
@NotNull(message = "La date prévue est obligatoire")
|
||||
private LocalDate datePrevue;
|
||||
|
||||
private LocalDate dateRealisee;
|
||||
|
||||
private BigDecimal cout;
|
||||
|
||||
private StatutMaintenance statut;
|
||||
|
||||
private String technicien;
|
||||
|
||||
private String notes;
|
||||
|
||||
private LocalDate prochaineMaintenance;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,61 +1,61 @@
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.StatutMaintenance;
|
||||
import dev.lions.btpxpress.domain.core.entity.TypeMaintenance;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la réponse d'une maintenance - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class MaintenanceResponseDTO {
|
||||
|
||||
private UUID id;
|
||||
|
||||
private TypeMaintenance type;
|
||||
|
||||
private String description;
|
||||
|
||||
private LocalDate datePrevue;
|
||||
|
||||
private LocalDate dateRealisee;
|
||||
|
||||
private BigDecimal cout;
|
||||
|
||||
private StatutMaintenance statut;
|
||||
|
||||
private String technicien;
|
||||
|
||||
private String notes;
|
||||
|
||||
private LocalDate prochaineMaintenance;
|
||||
|
||||
private LocalDateTime dateCreation;
|
||||
|
||||
private LocalDateTime dateModification;
|
||||
|
||||
// Relations simplifiées
|
||||
private UUID materielId;
|
||||
private String materielNom;
|
||||
private String materielReference;
|
||||
|
||||
// Métadonnées calculées
|
||||
private Boolean enRetard;
|
||||
|
||||
private Boolean terminee;
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.StatutMaintenance;
|
||||
import dev.lions.btpxpress.domain.core.entity.TypeMaintenance;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la réponse d'une maintenance - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class MaintenanceResponseDTO {
|
||||
|
||||
private UUID id;
|
||||
|
||||
private TypeMaintenance type;
|
||||
|
||||
private String description;
|
||||
|
||||
private LocalDate datePrevue;
|
||||
|
||||
private LocalDate dateRealisee;
|
||||
|
||||
private BigDecimal cout;
|
||||
|
||||
private StatutMaintenance statut;
|
||||
|
||||
private String technicien;
|
||||
|
||||
private String notes;
|
||||
|
||||
private LocalDate prochaineMaintenance;
|
||||
|
||||
private LocalDateTime dateCreation;
|
||||
|
||||
private LocalDateTime dateModification;
|
||||
|
||||
// Relations simplifiées
|
||||
private UUID materielId;
|
||||
private String materielNom;
|
||||
private String materielReference;
|
||||
|
||||
// Métadonnées calculées
|
||||
private Boolean enRetard;
|
||||
|
||||
private Boolean terminee;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,64 +1,64 @@
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.MaterielBTP.CategorieMateriel;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la création de matériel - Architecture 2025
|
||||
* Version simplifiée pour les opérations CRUD de base
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class MaterielCreateDTO {
|
||||
|
||||
@NotBlank(message = "Le code du matériel est obligatoire")
|
||||
private String code;
|
||||
|
||||
@NotBlank(message = "Le nom du matériel est obligatoire")
|
||||
private String nom;
|
||||
|
||||
private String description;
|
||||
|
||||
@NotNull(message = "La catégorie est obligatoire")
|
||||
private CategorieMateriel categorie;
|
||||
|
||||
private String sousCategorie;
|
||||
|
||||
private BigDecimal prixUnitaire;
|
||||
|
||||
private String unite;
|
||||
|
||||
private Integer stockDisponible;
|
||||
|
||||
private Integer stockMinimum;
|
||||
|
||||
private String fournisseur;
|
||||
|
||||
private UUID fournisseurId;
|
||||
|
||||
private String localisation;
|
||||
|
||||
@Builder.Default
|
||||
private Boolean actif = true;
|
||||
|
||||
/** Méthode de conversion String vers UUID pour fournisseurId */
|
||||
public void setFournisseurId(String fournisseurId) {
|
||||
if (fournisseurId != null && !fournisseurId.trim().isEmpty()) {
|
||||
this.fournisseurId = UUID.fromString(fournisseurId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.MaterielBTP.CategorieMateriel;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la création de matériel - Architecture 2025
|
||||
* Version simplifiée pour les opérations CRUD de base
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class MaterielCreateDTO {
|
||||
|
||||
@NotBlank(message = "Le code du matériel est obligatoire")
|
||||
private String code;
|
||||
|
||||
@NotBlank(message = "Le nom du matériel est obligatoire")
|
||||
private String nom;
|
||||
|
||||
private String description;
|
||||
|
||||
@NotNull(message = "La catégorie est obligatoire")
|
||||
private CategorieMateriel categorie;
|
||||
|
||||
private String sousCategorie;
|
||||
|
||||
private BigDecimal prixUnitaire;
|
||||
|
||||
private String unite;
|
||||
|
||||
private Integer stockDisponible;
|
||||
|
||||
private Integer stockMinimum;
|
||||
|
||||
private String fournisseur;
|
||||
|
||||
private UUID fournisseurId;
|
||||
|
||||
private String localisation;
|
||||
|
||||
@Builder.Default
|
||||
private Boolean actif = true;
|
||||
|
||||
/** Méthode de conversion String vers UUID pour fournisseurId */
|
||||
public void setFournisseurId(String fournisseurId) {
|
||||
if (fournisseurId != null && !fournisseurId.trim().isEmpty()) {
|
||||
this.fournisseurId = UUID.fromString(fournisseurId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,62 +1,62 @@
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.MaterielBTP.CategorieMateriel;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la réponse d'un matériel - Architecture 2025
|
||||
* Version simplifiée pour les opérations CRUD de base
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class MaterielResponseDTO {
|
||||
|
||||
private UUID id;
|
||||
|
||||
private String code;
|
||||
|
||||
private String nom;
|
||||
|
||||
private String description;
|
||||
|
||||
private CategorieMateriel categorie;
|
||||
|
||||
private String sousCategorie;
|
||||
|
||||
private BigDecimal prixUnitaire;
|
||||
|
||||
private String unite;
|
||||
|
||||
private Integer stockDisponible;
|
||||
|
||||
private Integer stockMinimum;
|
||||
|
||||
private String localisation;
|
||||
|
||||
private Boolean actif;
|
||||
|
||||
private LocalDateTime dateCreation;
|
||||
|
||||
private LocalDateTime dateModification;
|
||||
|
||||
// Relations simplifiées
|
||||
private UUID fournisseurId;
|
||||
private String fournisseurNom;
|
||||
|
||||
private Integer nombreReservations;
|
||||
|
||||
private Integer nombreMaintenances;
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.MaterielBTP.CategorieMateriel;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la réponse d'un matériel - Architecture 2025
|
||||
* Version simplifiée pour les opérations CRUD de base
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class MaterielResponseDTO {
|
||||
|
||||
private UUID id;
|
||||
|
||||
private String code;
|
||||
|
||||
private String nom;
|
||||
|
||||
private String description;
|
||||
|
||||
private CategorieMateriel categorie;
|
||||
|
||||
private String sousCategorie;
|
||||
|
||||
private BigDecimal prixUnitaire;
|
||||
|
||||
private String unite;
|
||||
|
||||
private Integer stockDisponible;
|
||||
|
||||
private Integer stockMinimum;
|
||||
|
||||
private String localisation;
|
||||
|
||||
private Boolean actif;
|
||||
|
||||
private LocalDateTime dateCreation;
|
||||
|
||||
private LocalDateTime dateModification;
|
||||
|
||||
// Relations simplifiées
|
||||
private UUID fournisseurId;
|
||||
private String fournisseurNom;
|
||||
|
||||
private Integer nombreReservations;
|
||||
|
||||
private Integer nombreMaintenances;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,52 +1,52 @@
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.PrioriteMessage;
|
||||
import dev.lions.btpxpress.domain.core.entity.TypeMessage;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la création d'un message - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class MessageCreateDTO {
|
||||
|
||||
@NotBlank(message = "Le sujet est obligatoire")
|
||||
private String sujet;
|
||||
|
||||
@NotBlank(message = "Le contenu est obligatoire")
|
||||
private String contenu;
|
||||
|
||||
@NotNull(message = "L'expéditeur est obligatoire")
|
||||
private UUID expediteurId;
|
||||
|
||||
@NotNull(message = "Le destinataire est obligatoire")
|
||||
private UUID destinataireId;
|
||||
|
||||
private TypeMessage type;
|
||||
|
||||
private PrioriteMessage priorite;
|
||||
|
||||
private Boolean important;
|
||||
|
||||
private String fichiersJoints; // JSON array des IDs de documents
|
||||
|
||||
private UUID messageParentId; // Pour les réponses
|
||||
|
||||
private UUID chantierId;
|
||||
|
||||
private UUID equipeId;
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.PrioriteMessage;
|
||||
import dev.lions.btpxpress.domain.core.entity.TypeMessage;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la création d'un message - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class MessageCreateDTO {
|
||||
|
||||
@NotBlank(message = "Le sujet est obligatoire")
|
||||
private String sujet;
|
||||
|
||||
@NotBlank(message = "Le contenu est obligatoire")
|
||||
private String contenu;
|
||||
|
||||
@NotNull(message = "L'expéditeur est obligatoire")
|
||||
private UUID expediteurId;
|
||||
|
||||
@NotNull(message = "Le destinataire est obligatoire")
|
||||
private UUID destinataireId;
|
||||
|
||||
private TypeMessage type;
|
||||
|
||||
private PrioriteMessage priorite;
|
||||
|
||||
private Boolean important;
|
||||
|
||||
private String fichiersJoints; // JSON array des IDs de documents
|
||||
|
||||
private UUID messageParentId; // Pour les réponses
|
||||
|
||||
private UUID chantierId;
|
||||
|
||||
private UUID equipeId;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,85 +1,85 @@
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.PrioriteMessage;
|
||||
import dev.lions.btpxpress.domain.core.entity.TypeMessage;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la réponse d'un message - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class MessageResponseDTO {
|
||||
|
||||
private UUID id;
|
||||
|
||||
private String sujet;
|
||||
|
||||
private String contenu;
|
||||
|
||||
private TypeMessage type;
|
||||
|
||||
private PrioriteMessage priorite;
|
||||
|
||||
private Boolean lu;
|
||||
|
||||
private LocalDateTime dateLecture;
|
||||
|
||||
private Boolean important;
|
||||
|
||||
private Boolean archive;
|
||||
|
||||
private LocalDateTime dateArchivage;
|
||||
|
||||
private String fichiersJoints;
|
||||
|
||||
private LocalDateTime dateCreation;
|
||||
|
||||
private LocalDateTime dateModification;
|
||||
|
||||
private Boolean actif;
|
||||
|
||||
// Relations simplifiées
|
||||
private UUID expediteurId;
|
||||
private String expediteurNom;
|
||||
private String expediteurPrenom;
|
||||
private String expediteurEmail;
|
||||
|
||||
private UUID destinataireId;
|
||||
private String destinataireNom;
|
||||
private String destinatairePrenom;
|
||||
private String destinataireEmail;
|
||||
|
||||
private UUID messageParentId;
|
||||
|
||||
private UUID chantierId;
|
||||
private String chantierNom;
|
||||
|
||||
private UUID equipeId;
|
||||
private String equipeNom;
|
||||
|
||||
// Métadonnées calculées
|
||||
private Integer nombreReponses;
|
||||
|
||||
private Boolean estReponse;
|
||||
|
||||
private Boolean aDesReponses;
|
||||
|
||||
private Boolean estCritique;
|
||||
|
||||
private Boolean estHautePriorite;
|
||||
|
||||
private Boolean estRecent;
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.PrioriteMessage;
|
||||
import dev.lions.btpxpress.domain.core.entity.TypeMessage;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la réponse d'un message - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class MessageResponseDTO {
|
||||
|
||||
private UUID id;
|
||||
|
||||
private String sujet;
|
||||
|
||||
private String contenu;
|
||||
|
||||
private TypeMessage type;
|
||||
|
||||
private PrioriteMessage priorite;
|
||||
|
||||
private Boolean lu;
|
||||
|
||||
private LocalDateTime dateLecture;
|
||||
|
||||
private Boolean important;
|
||||
|
||||
private Boolean archive;
|
||||
|
||||
private LocalDateTime dateArchivage;
|
||||
|
||||
private String fichiersJoints;
|
||||
|
||||
private LocalDateTime dateCreation;
|
||||
|
||||
private LocalDateTime dateModification;
|
||||
|
||||
private Boolean actif;
|
||||
|
||||
// Relations simplifiées
|
||||
private UUID expediteurId;
|
||||
private String expediteurNom;
|
||||
private String expediteurPrenom;
|
||||
private String expediteurEmail;
|
||||
|
||||
private UUID destinataireId;
|
||||
private String destinataireNom;
|
||||
private String destinatairePrenom;
|
||||
private String destinataireEmail;
|
||||
|
||||
private UUID messageParentId;
|
||||
|
||||
private UUID chantierId;
|
||||
private String chantierNom;
|
||||
|
||||
private UUID equipeId;
|
||||
private String equipeNom;
|
||||
|
||||
// Métadonnées calculées
|
||||
private Integer nombreReponses;
|
||||
|
||||
private Boolean estReponse;
|
||||
|
||||
private Boolean aDesReponses;
|
||||
|
||||
private Boolean estCritique;
|
||||
|
||||
private Boolean estHautePriorite;
|
||||
|
||||
private Boolean estRecent;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,52 +1,52 @@
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.PrioriteNotification;
|
||||
import dev.lions.btpxpress.domain.core.entity.TypeNotification;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la création d'une notification - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class NotificationCreateDTO {
|
||||
|
||||
@NotBlank(message = "Le titre est obligatoire")
|
||||
private String titre;
|
||||
|
||||
@NotBlank(message = "Le message est obligatoire")
|
||||
private String message;
|
||||
|
||||
@NotNull(message = "Le type est obligatoire")
|
||||
private TypeNotification type;
|
||||
|
||||
@NotNull(message = "L'utilisateur destinataire est obligatoire")
|
||||
private UUID userId;
|
||||
|
||||
private PrioriteNotification priorite;
|
||||
|
||||
private String lienAction;
|
||||
|
||||
private String donnees;
|
||||
|
||||
private UUID chantierId;
|
||||
|
||||
private UUID materielId;
|
||||
|
||||
private UUID maintenanceId;
|
||||
|
||||
private UUID creeeParId;
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.PrioriteNotification;
|
||||
import dev.lions.btpxpress.domain.core.entity.TypeNotification;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la création d'une notification - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class NotificationCreateDTO {
|
||||
|
||||
@NotBlank(message = "Le titre est obligatoire")
|
||||
private String titre;
|
||||
|
||||
@NotBlank(message = "Le message est obligatoire")
|
||||
private String message;
|
||||
|
||||
@NotNull(message = "Le type est obligatoire")
|
||||
private TypeNotification type;
|
||||
|
||||
@NotNull(message = "L'utilisateur destinataire est obligatoire")
|
||||
private UUID userId;
|
||||
|
||||
private PrioriteNotification priorite;
|
||||
|
||||
private String lienAction;
|
||||
|
||||
private String donnees;
|
||||
|
||||
private UUID chantierId;
|
||||
|
||||
private UUID materielId;
|
||||
|
||||
private UUID maintenanceId;
|
||||
|
||||
private UUID creeeParId;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,78 +1,78 @@
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.PrioriteNotification;
|
||||
import dev.lions.btpxpress.domain.core.entity.TypeNotification;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la réponse d'une notification - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class NotificationResponseDTO {
|
||||
|
||||
private UUID id;
|
||||
|
||||
private String titre;
|
||||
|
||||
private String message;
|
||||
|
||||
private TypeNotification type;
|
||||
|
||||
private PrioriteNotification priorite;
|
||||
|
||||
private Boolean lue;
|
||||
|
||||
private LocalDateTime dateLecture;
|
||||
|
||||
private String lienAction;
|
||||
|
||||
private String donnees;
|
||||
|
||||
private LocalDateTime dateCreation;
|
||||
|
||||
private LocalDateTime dateModification;
|
||||
|
||||
private Boolean actif;
|
||||
|
||||
// Relations simplifiées
|
||||
private UUID userId;
|
||||
private String userNom;
|
||||
private String userPrenom;
|
||||
private String userEmail;
|
||||
|
||||
private UUID chantierId;
|
||||
private String chantierNom;
|
||||
|
||||
private UUID materielId;
|
||||
private String materielNom;
|
||||
|
||||
private UUID maintenanceId;
|
||||
|
||||
private UUID creeeParId;
|
||||
private String creeeParNom;
|
||||
private String creeeParEmail;
|
||||
|
||||
// Métadonnées calculées
|
||||
private Boolean estCritique;
|
||||
|
||||
private Boolean estHautePriorite;
|
||||
|
||||
private Boolean estRecente;
|
||||
|
||||
private Boolean hasLienAction;
|
||||
|
||||
private Boolean hasDonnees;
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.PrioriteNotification;
|
||||
import dev.lions.btpxpress.domain.core.entity.TypeNotification;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la réponse d'une notification - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class NotificationResponseDTO {
|
||||
|
||||
private UUID id;
|
||||
|
||||
private String titre;
|
||||
|
||||
private String message;
|
||||
|
||||
private TypeNotification type;
|
||||
|
||||
private PrioriteNotification priorite;
|
||||
|
||||
private Boolean lue;
|
||||
|
||||
private LocalDateTime dateLecture;
|
||||
|
||||
private String lienAction;
|
||||
|
||||
private String donnees;
|
||||
|
||||
private LocalDateTime dateCreation;
|
||||
|
||||
private LocalDateTime dateModification;
|
||||
|
||||
private Boolean actif;
|
||||
|
||||
// Relations simplifiées
|
||||
private UUID userId;
|
||||
private String userNom;
|
||||
private String userPrenom;
|
||||
private String userEmail;
|
||||
|
||||
private UUID chantierId;
|
||||
private String chantierNom;
|
||||
|
||||
private UUID materielId;
|
||||
private String materielNom;
|
||||
|
||||
private UUID maintenanceId;
|
||||
|
||||
private UUID creeeParId;
|
||||
private String creeeParNom;
|
||||
private String creeeParEmail;
|
||||
|
||||
// Métadonnées calculées
|
||||
private Boolean estCritique;
|
||||
|
||||
private Boolean estHautePriorite;
|
||||
|
||||
private Boolean estRecente;
|
||||
|
||||
private Boolean hasLienAction;
|
||||
|
||||
private Boolean hasDonnees;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,148 +1,148 @@
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* Wrapper pour les réponses paginées - Architecture 2025
|
||||
*
|
||||
* Format pour les réponses avec pagination :
|
||||
* {
|
||||
* "data": [...],
|
||||
* "pagination": {
|
||||
* "page": 0,
|
||||
* "size": 20,
|
||||
* "total": 100,
|
||||
* "totalPages": 5,
|
||||
* "hasNext": true,
|
||||
* "hasPrevious": false
|
||||
* },
|
||||
* "success": true,
|
||||
* "timestamp": "2025-01-30T10:00:00"
|
||||
* }
|
||||
*
|
||||
* @param <T> Le type d'éléments dans la liste
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class PagedResponse<T> {
|
||||
|
||||
/**
|
||||
* Les données paginées
|
||||
*/
|
||||
private List<T> data;
|
||||
|
||||
/**
|
||||
* Métadonnées de pagination
|
||||
*/
|
||||
private PaginationInfo pagination;
|
||||
|
||||
/**
|
||||
* Indique si l'opération a réussi
|
||||
*/
|
||||
@Builder.Default
|
||||
private Boolean success = true;
|
||||
|
||||
/**
|
||||
* Message descriptif (optionnel)
|
||||
*/
|
||||
private String message;
|
||||
|
||||
/**
|
||||
* Timestamp de la réponse
|
||||
*/
|
||||
@Builder.Default
|
||||
private LocalDateTime timestamp = LocalDateTime.now();
|
||||
|
||||
/**
|
||||
* Informations de pagination
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public static class PaginationInfo {
|
||||
/**
|
||||
* Numéro de page (0-based)
|
||||
*/
|
||||
private Integer page;
|
||||
|
||||
/**
|
||||
* Taille de la page
|
||||
*/
|
||||
private Integer size;
|
||||
|
||||
/**
|
||||
* Nombre total d'éléments
|
||||
*/
|
||||
private Long total;
|
||||
|
||||
/**
|
||||
* Nombre total de pages
|
||||
*/
|
||||
private Integer totalPages;
|
||||
|
||||
/**
|
||||
* Indique s'il y a une page suivante
|
||||
*/
|
||||
private Boolean hasNext;
|
||||
|
||||
/**
|
||||
* Indique s'il y a une page précédente
|
||||
*/
|
||||
private Boolean hasPrevious;
|
||||
}
|
||||
|
||||
// === MÉTHODES STATIQUES DE FACTORY ===
|
||||
|
||||
/**
|
||||
* Crée une réponse paginée
|
||||
*
|
||||
* @param data Les données de la page
|
||||
* @param page Le numéro de page (0-based)
|
||||
* @param size La taille de la page
|
||||
* @param total Le nombre total d'éléments
|
||||
*/
|
||||
public static <T> PagedResponse<T> of(List<T> data, int page, int size, long total) {
|
||||
int totalPages = size > 0 ? (int) Math.ceil((double) total / size) : 0;
|
||||
|
||||
PaginationInfo pagination = PaginationInfo.builder()
|
||||
.page(page)
|
||||
.size(size)
|
||||
.total(total)
|
||||
.totalPages(totalPages)
|
||||
.hasNext(page < totalPages - 1)
|
||||
.hasPrevious(page > 0)
|
||||
.build();
|
||||
|
||||
return PagedResponse.<T>builder()
|
||||
.data(data)
|
||||
.pagination(pagination)
|
||||
.success(true)
|
||||
.timestamp(LocalDateTime.now())
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Crée une réponse paginée avec un message
|
||||
*/
|
||||
public static <T> PagedResponse<T> of(List<T> data, int page, int size, long total, String message) {
|
||||
PagedResponse<T> response = of(data, page, size, total);
|
||||
response.setMessage(message);
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* Wrapper pour les réponses paginées - Architecture 2025
|
||||
*
|
||||
* Format pour les réponses avec pagination :
|
||||
* {
|
||||
* "data": [...],
|
||||
* "pagination": {
|
||||
* "page": 0,
|
||||
* "size": 20,
|
||||
* "total": 100,
|
||||
* "totalPages": 5,
|
||||
* "hasNext": true,
|
||||
* "hasPrevious": false
|
||||
* },
|
||||
* "success": true,
|
||||
* "timestamp": "2025-01-30T10:00:00"
|
||||
* }
|
||||
*
|
||||
* @param <T> Le type d'éléments dans la liste
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class PagedResponse<T> {
|
||||
|
||||
/**
|
||||
* Les données paginées
|
||||
*/
|
||||
private List<T> data;
|
||||
|
||||
/**
|
||||
* Métadonnées de pagination
|
||||
*/
|
||||
private PaginationInfo pagination;
|
||||
|
||||
/**
|
||||
* Indique si l'opération a réussi
|
||||
*/
|
||||
@Builder.Default
|
||||
private Boolean success = true;
|
||||
|
||||
/**
|
||||
* Message descriptif (optionnel)
|
||||
*/
|
||||
private String message;
|
||||
|
||||
/**
|
||||
* Timestamp de la réponse
|
||||
*/
|
||||
@Builder.Default
|
||||
private LocalDateTime timestamp = LocalDateTime.now();
|
||||
|
||||
/**
|
||||
* Informations de pagination
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public static class PaginationInfo {
|
||||
/**
|
||||
* Numéro de page (0-based)
|
||||
*/
|
||||
private Integer page;
|
||||
|
||||
/**
|
||||
* Taille de la page
|
||||
*/
|
||||
private Integer size;
|
||||
|
||||
/**
|
||||
* Nombre total d'éléments
|
||||
*/
|
||||
private Long total;
|
||||
|
||||
/**
|
||||
* Nombre total de pages
|
||||
*/
|
||||
private Integer totalPages;
|
||||
|
||||
/**
|
||||
* Indique s'il y a une page suivante
|
||||
*/
|
||||
private Boolean hasNext;
|
||||
|
||||
/**
|
||||
* Indique s'il y a une page précédente
|
||||
*/
|
||||
private Boolean hasPrevious;
|
||||
}
|
||||
|
||||
// === MÉTHODES STATIQUES DE FACTORY ===
|
||||
|
||||
/**
|
||||
* Crée une réponse paginée
|
||||
*
|
||||
* @param data Les données de la page
|
||||
* @param page Le numéro de page (0-based)
|
||||
* @param size La taille de la page
|
||||
* @param total Le nombre total d'éléments
|
||||
*/
|
||||
public static <T> PagedResponse<T> of(List<T> data, int page, int size, long total) {
|
||||
int totalPages = size > 0 ? (int) Math.ceil((double) total / size) : 0;
|
||||
|
||||
PaginationInfo pagination = PaginationInfo.builder()
|
||||
.page(page)
|
||||
.size(size)
|
||||
.total(total)
|
||||
.totalPages(totalPages)
|
||||
.hasNext(page < totalPages - 1)
|
||||
.hasPrevious(page > 0)
|
||||
.build();
|
||||
|
||||
return PagedResponse.<T>builder()
|
||||
.data(data)
|
||||
.pagination(pagination)
|
||||
.success(true)
|
||||
.timestamp(LocalDateTime.now())
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Crée une réponse paginée avec un message
|
||||
*/
|
||||
public static <T> PagedResponse<T> of(List<T> data, int page, int size, long total, String message) {
|
||||
PagedResponse<T> response = of(data, page, size, total);
|
||||
response.setMessage(message);
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,81 +1,81 @@
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.PrioritePhase;
|
||||
import dev.lions.btpxpress.domain.core.entity.TypePhaseChantier;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la création d'une phase de chantier - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PhaseChantierCreateDTO {
|
||||
|
||||
@NotBlank(message = "Le nom est obligatoire")
|
||||
private String nom;
|
||||
|
||||
private String description;
|
||||
|
||||
@NotNull(message = "Le chantier est obligatoire")
|
||||
private UUID chantierId;
|
||||
|
||||
private TypePhaseChantier type;
|
||||
|
||||
@NotNull(message = "L'ordre d'exécution est obligatoire")
|
||||
private Integer ordreExecution;
|
||||
|
||||
private LocalDate dateDebutPrevue;
|
||||
|
||||
private LocalDate dateFinPrevue;
|
||||
|
||||
private BigDecimal budgetPrevu;
|
||||
|
||||
private String equipeResponsableNom;
|
||||
|
||||
private String chefEquipeNom;
|
||||
|
||||
private Integer dureePrevueJours;
|
||||
|
||||
private PrioritePhase priorite;
|
||||
|
||||
private String prerequis;
|
||||
|
||||
private String livrablesAttendus;
|
||||
|
||||
private String commentaires;
|
||||
|
||||
private String risquesIdentifies;
|
||||
|
||||
private String mesuresSecurite;
|
||||
|
||||
private String materielRequis;
|
||||
|
||||
private String competencesRequises;
|
||||
|
||||
private Boolean bloquante;
|
||||
|
||||
private Boolean facturable;
|
||||
|
||||
private String code;
|
||||
|
||||
private String categorie;
|
||||
|
||||
private String objectifs;
|
||||
|
||||
private UUID phaseParentId;
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.PrioritePhase;
|
||||
import dev.lions.btpxpress.domain.core.entity.TypePhaseChantier;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la création d'une phase de chantier - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PhaseChantierCreateDTO {
|
||||
|
||||
@NotBlank(message = "Le nom est obligatoire")
|
||||
private String nom;
|
||||
|
||||
private String description;
|
||||
|
||||
@NotNull(message = "Le chantier est obligatoire")
|
||||
private UUID chantierId;
|
||||
|
||||
private TypePhaseChantier type;
|
||||
|
||||
@NotNull(message = "L'ordre d'exécution est obligatoire")
|
||||
private Integer ordreExecution;
|
||||
|
||||
private LocalDate dateDebutPrevue;
|
||||
|
||||
private LocalDate dateFinPrevue;
|
||||
|
||||
private BigDecimal budgetPrevu;
|
||||
|
||||
private String equipeResponsableNom;
|
||||
|
||||
private String chefEquipeNom;
|
||||
|
||||
private Integer dureePrevueJours;
|
||||
|
||||
private PrioritePhase priorite;
|
||||
|
||||
private String prerequis;
|
||||
|
||||
private String livrablesAttendus;
|
||||
|
||||
private String commentaires;
|
||||
|
||||
private String risquesIdentifies;
|
||||
|
||||
private String mesuresSecurite;
|
||||
|
||||
private String materielRequis;
|
||||
|
||||
private String competencesRequises;
|
||||
|
||||
private Boolean bloquante;
|
||||
|
||||
private Boolean facturable;
|
||||
|
||||
private String code;
|
||||
|
||||
private String categorie;
|
||||
|
||||
private String objectifs;
|
||||
|
||||
private UUID phaseParentId;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,115 +1,115 @@
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.PrioritePhase;
|
||||
import dev.lions.btpxpress.domain.core.entity.StatutPhaseChantier;
|
||||
import dev.lions.btpxpress.domain.core.entity.TypePhaseChantier;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la réponse d'une phase de chantier - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PhaseChantierResponseDTO {
|
||||
|
||||
private UUID id;
|
||||
|
||||
private String nom;
|
||||
|
||||
private String description;
|
||||
|
||||
private StatutPhaseChantier statut;
|
||||
|
||||
private TypePhaseChantier type;
|
||||
|
||||
private Integer ordreExecution;
|
||||
|
||||
private LocalDate dateDebutPrevue;
|
||||
|
||||
private LocalDate dateFinPrevue;
|
||||
|
||||
private LocalDate dateDebutReelle;
|
||||
|
||||
private LocalDate dateFinReelle;
|
||||
|
||||
private BigDecimal pourcentageAvancement;
|
||||
|
||||
private BigDecimal budgetPrevu;
|
||||
|
||||
private BigDecimal coutReel;
|
||||
|
||||
private String equipeResponsableNom;
|
||||
|
||||
private String chefEquipeNom;
|
||||
|
||||
private Integer dureePrevueJours;
|
||||
|
||||
private Integer dureeReelleJours;
|
||||
|
||||
private PrioritePhase priorite;
|
||||
|
||||
private String prerequis;
|
||||
|
||||
private String livrablesAttendus;
|
||||
|
||||
private String commentaires;
|
||||
|
||||
private String risquesIdentifies;
|
||||
|
||||
private String mesuresSecurite;
|
||||
|
||||
private String materielRequis;
|
||||
|
||||
private String competencesRequises;
|
||||
|
||||
private Boolean bloquante;
|
||||
|
||||
private Boolean facturable;
|
||||
|
||||
private Boolean actif;
|
||||
|
||||
private String code;
|
||||
|
||||
private String categorie;
|
||||
|
||||
private String objectifs;
|
||||
|
||||
// Relations simplifiées
|
||||
private UUID chantierId;
|
||||
private String chantierNom;
|
||||
|
||||
private UUID phaseParentId;
|
||||
private String phaseParentNom;
|
||||
|
||||
private Integer nombreSousPhases;
|
||||
|
||||
// Métadonnées
|
||||
private LocalDateTime dateCreation;
|
||||
|
||||
private LocalDateTime dateModification;
|
||||
|
||||
private String creePar;
|
||||
|
||||
private String modifiePar;
|
||||
|
||||
// Calculs
|
||||
private Boolean enRetard;
|
||||
|
||||
private Boolean enCours;
|
||||
|
||||
private Boolean terminee;
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.PrioritePhase;
|
||||
import dev.lions.btpxpress.domain.core.entity.StatutPhaseChantier;
|
||||
import dev.lions.btpxpress.domain.core.entity.TypePhaseChantier;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la réponse d'une phase de chantier - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PhaseChantierResponseDTO {
|
||||
|
||||
private UUID id;
|
||||
|
||||
private String nom;
|
||||
|
||||
private String description;
|
||||
|
||||
private StatutPhaseChantier statut;
|
||||
|
||||
private TypePhaseChantier type;
|
||||
|
||||
private Integer ordreExecution;
|
||||
|
||||
private LocalDate dateDebutPrevue;
|
||||
|
||||
private LocalDate dateFinPrevue;
|
||||
|
||||
private LocalDate dateDebutReelle;
|
||||
|
||||
private LocalDate dateFinReelle;
|
||||
|
||||
private BigDecimal pourcentageAvancement;
|
||||
|
||||
private BigDecimal budgetPrevu;
|
||||
|
||||
private BigDecimal coutReel;
|
||||
|
||||
private String equipeResponsableNom;
|
||||
|
||||
private String chefEquipeNom;
|
||||
|
||||
private Integer dureePrevueJours;
|
||||
|
||||
private Integer dureeReelleJours;
|
||||
|
||||
private PrioritePhase priorite;
|
||||
|
||||
private String prerequis;
|
||||
|
||||
private String livrablesAttendus;
|
||||
|
||||
private String commentaires;
|
||||
|
||||
private String risquesIdentifies;
|
||||
|
||||
private String mesuresSecurite;
|
||||
|
||||
private String materielRequis;
|
||||
|
||||
private String competencesRequises;
|
||||
|
||||
private Boolean bloquante;
|
||||
|
||||
private Boolean facturable;
|
||||
|
||||
private Boolean actif;
|
||||
|
||||
private String code;
|
||||
|
||||
private String categorie;
|
||||
|
||||
private String objectifs;
|
||||
|
||||
// Relations simplifiées
|
||||
private UUID chantierId;
|
||||
private String chantierNom;
|
||||
|
||||
private UUID phaseParentId;
|
||||
private String phaseParentNom;
|
||||
|
||||
private Integer nombreSousPhases;
|
||||
|
||||
// Métadonnées
|
||||
private LocalDateTime dateCreation;
|
||||
|
||||
private LocalDateTime dateModification;
|
||||
|
||||
private String creePar;
|
||||
|
||||
private String modifiePar;
|
||||
|
||||
// Calculs
|
||||
private Boolean enRetard;
|
||||
|
||||
private Boolean enCours;
|
||||
|
||||
private Boolean terminee;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,57 +1,57 @@
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.PrioritePlanningEvent;
|
||||
import dev.lions.btpxpress.domain.core.entity.TypePlanningEvent;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la création d'un événement de planning - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PlanningEventCreateDTO {
|
||||
|
||||
@NotBlank(message = "Le titre est obligatoire")
|
||||
private String titre;
|
||||
|
||||
private String description;
|
||||
|
||||
@NotNull(message = "La date de début est obligatoire")
|
||||
private LocalDateTime dateDebut;
|
||||
|
||||
@NotNull(message = "La date de fin est obligatoire")
|
||||
private LocalDateTime dateFin;
|
||||
|
||||
@NotNull(message = "Le type d'événement est obligatoire")
|
||||
private TypePlanningEvent type;
|
||||
|
||||
private PrioritePlanningEvent priorite;
|
||||
|
||||
private String notes;
|
||||
|
||||
private String couleur;
|
||||
|
||||
// Relations
|
||||
private UUID chantierId;
|
||||
|
||||
private UUID equipeId;
|
||||
|
||||
private List<UUID> employeIds;
|
||||
|
||||
private List<UUID> materielIds;
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.PrioritePlanningEvent;
|
||||
import dev.lions.btpxpress.domain.core.entity.TypePlanningEvent;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la création d'un événement de planning - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PlanningEventCreateDTO {
|
||||
|
||||
@NotBlank(message = "Le titre est obligatoire")
|
||||
private String titre;
|
||||
|
||||
private String description;
|
||||
|
||||
@NotNull(message = "La date de début est obligatoire")
|
||||
private LocalDateTime dateDebut;
|
||||
|
||||
@NotNull(message = "La date de fin est obligatoire")
|
||||
private LocalDateTime dateFin;
|
||||
|
||||
@NotNull(message = "Le type d'événement est obligatoire")
|
||||
private TypePlanningEvent type;
|
||||
|
||||
private PrioritePlanningEvent priorite;
|
||||
|
||||
private String notes;
|
||||
|
||||
private String couleur;
|
||||
|
||||
// Relations
|
||||
private UUID chantierId;
|
||||
|
||||
private UUID equipeId;
|
||||
|
||||
private List<UUID> employeIds;
|
||||
|
||||
private List<UUID> materielIds;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,75 +1,75 @@
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.PrioritePlanningEvent;
|
||||
import dev.lions.btpxpress.domain.core.entity.StatutPlanningEvent;
|
||||
import dev.lions.btpxpress.domain.core.entity.TypePlanningEvent;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la réponse d'un événement de planning - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PlanningEventResponseDTO {
|
||||
|
||||
private UUID id;
|
||||
|
||||
private String titre;
|
||||
|
||||
private String description;
|
||||
|
||||
private LocalDateTime dateDebut;
|
||||
|
||||
private LocalDateTime dateFin;
|
||||
|
||||
private TypePlanningEvent type;
|
||||
|
||||
private StatutPlanningEvent statut;
|
||||
|
||||
private PrioritePlanningEvent priorite;
|
||||
|
||||
private String notes;
|
||||
|
||||
private String couleur;
|
||||
|
||||
private LocalDateTime dateCreation;
|
||||
|
||||
private LocalDateTime dateModification;
|
||||
|
||||
private Boolean actif;
|
||||
|
||||
// Relations simplifiées
|
||||
private UUID chantierId;
|
||||
private String chantierNom;
|
||||
|
||||
private UUID equipeId;
|
||||
private String equipeNom;
|
||||
|
||||
private List<UUID> employeIds;
|
||||
private Integer nombreEmployes;
|
||||
|
||||
private List<UUID> materielIds;
|
||||
private Integer nombreMateriels;
|
||||
|
||||
// Métadonnées calculées
|
||||
private Long dureeEnHeures;
|
||||
|
||||
private Boolean enCours;
|
||||
|
||||
private Boolean termine;
|
||||
|
||||
private Boolean enRetard;
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.PrioritePlanningEvent;
|
||||
import dev.lions.btpxpress.domain.core.entity.StatutPlanningEvent;
|
||||
import dev.lions.btpxpress.domain.core.entity.TypePlanningEvent;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la réponse d'un événement de planning - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PlanningEventResponseDTO {
|
||||
|
||||
private UUID id;
|
||||
|
||||
private String titre;
|
||||
|
||||
private String description;
|
||||
|
||||
private LocalDateTime dateDebut;
|
||||
|
||||
private LocalDateTime dateFin;
|
||||
|
||||
private TypePlanningEvent type;
|
||||
|
||||
private StatutPlanningEvent statut;
|
||||
|
||||
private PrioritePlanningEvent priorite;
|
||||
|
||||
private String notes;
|
||||
|
||||
private String couleur;
|
||||
|
||||
private LocalDateTime dateCreation;
|
||||
|
||||
private LocalDateTime dateModification;
|
||||
|
||||
private Boolean actif;
|
||||
|
||||
// Relations simplifiées
|
||||
private UUID chantierId;
|
||||
private String chantierNom;
|
||||
|
||||
private UUID equipeId;
|
||||
private String equipeNom;
|
||||
|
||||
private List<UUID> employeIds;
|
||||
private Integer nombreEmployes;
|
||||
|
||||
private List<UUID> materielIds;
|
||||
private Integer nombreMateriels;
|
||||
|
||||
// Métadonnées calculées
|
||||
private Long dureeEnHeures;
|
||||
|
||||
private Boolean enCours;
|
||||
|
||||
private Boolean termine;
|
||||
|
||||
private Boolean enRetard;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,87 +1,87 @@
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.StatutPlanning;
|
||||
import dev.lions.btpxpress.domain.core.entity.TypePlanning;
|
||||
import dev.lions.btpxpress.domain.core.entity.VuePlanning;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.time.LocalDate;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la création d'un planning de matériel - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PlanningMaterielCreateDTO {
|
||||
|
||||
@NotNull(message = "Le matériel est obligatoire")
|
||||
private UUID materielId;
|
||||
|
||||
@NotBlank(message = "Le nom du planning est obligatoire")
|
||||
private String nomPlanning;
|
||||
|
||||
private String descriptionPlanning;
|
||||
|
||||
@NotNull(message = "La date de début est obligatoire")
|
||||
private LocalDate dateDebut;
|
||||
|
||||
@NotNull(message = "La date de fin est obligatoire")
|
||||
private LocalDate dateFin;
|
||||
|
||||
@NotNull(message = "Le type de planning est obligatoire")
|
||||
private TypePlanning typePlanning;
|
||||
|
||||
private StatutPlanning statutPlanning;
|
||||
|
||||
private Integer versionPlanning;
|
||||
|
||||
private UUID planningParentId;
|
||||
|
||||
private String planificateur;
|
||||
|
||||
private String valideur;
|
||||
|
||||
private String commentairesValidation;
|
||||
|
||||
private Boolean conflitsDetectes;
|
||||
|
||||
private Integer nombreConflits;
|
||||
|
||||
private Boolean resolutionConflitsAuto;
|
||||
|
||||
private Double tauxUtilisationPrevu;
|
||||
|
||||
private Double scoreOptimisation;
|
||||
|
||||
private Boolean optimiseAutomatiquement;
|
||||
|
||||
private Boolean notificationsActivees;
|
||||
|
||||
private Boolean alerteConflits;
|
||||
|
||||
private Boolean alerteSurcharge;
|
||||
|
||||
private Double seuilAlerteUtilisation;
|
||||
|
||||
private String couleurPlanning;
|
||||
|
||||
private VuePlanning vueParDefaut;
|
||||
|
||||
private String granulariteAffichage;
|
||||
|
||||
private String optionsAffichage; // JSON
|
||||
|
||||
private String reglesPlanification; // JSON
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.StatutPlanning;
|
||||
import dev.lions.btpxpress.domain.core.entity.TypePlanning;
|
||||
import dev.lions.btpxpress.domain.core.entity.VuePlanning;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.time.LocalDate;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la création d'un planning de matériel - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PlanningMaterielCreateDTO {
|
||||
|
||||
@NotNull(message = "Le matériel est obligatoire")
|
||||
private UUID materielId;
|
||||
|
||||
@NotBlank(message = "Le nom du planning est obligatoire")
|
||||
private String nomPlanning;
|
||||
|
||||
private String descriptionPlanning;
|
||||
|
||||
@NotNull(message = "La date de début est obligatoire")
|
||||
private LocalDate dateDebut;
|
||||
|
||||
@NotNull(message = "La date de fin est obligatoire")
|
||||
private LocalDate dateFin;
|
||||
|
||||
@NotNull(message = "Le type de planning est obligatoire")
|
||||
private TypePlanning typePlanning;
|
||||
|
||||
private StatutPlanning statutPlanning;
|
||||
|
||||
private Integer versionPlanning;
|
||||
|
||||
private UUID planningParentId;
|
||||
|
||||
private String planificateur;
|
||||
|
||||
private String valideur;
|
||||
|
||||
private String commentairesValidation;
|
||||
|
||||
private Boolean conflitsDetectes;
|
||||
|
||||
private Integer nombreConflits;
|
||||
|
||||
private Boolean resolutionConflitsAuto;
|
||||
|
||||
private Double tauxUtilisationPrevu;
|
||||
|
||||
private Double scoreOptimisation;
|
||||
|
||||
private Boolean optimiseAutomatiquement;
|
||||
|
||||
private Boolean notificationsActivees;
|
||||
|
||||
private Boolean alerteConflits;
|
||||
|
||||
private Boolean alerteSurcharge;
|
||||
|
||||
private Double seuilAlerteUtilisation;
|
||||
|
||||
private String couleurPlanning;
|
||||
|
||||
private VuePlanning vueParDefaut;
|
||||
|
||||
private String granulariteAffichage;
|
||||
|
||||
private String optionsAffichage; // JSON
|
||||
|
||||
private String reglesPlanification; // JSON
|
||||
}
|
||||
|
||||
|
||||
@@ -1,118 +1,118 @@
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.StatutPlanning;
|
||||
import dev.lions.btpxpress.domain.core.entity.TypePlanning;
|
||||
import dev.lions.btpxpress.domain.core.entity.VuePlanning;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la réponse d'un planning de matériel - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PlanningMaterielResponseDTO {
|
||||
|
||||
private UUID id;
|
||||
|
||||
private String nomPlanning;
|
||||
|
||||
private String descriptionPlanning;
|
||||
|
||||
private LocalDate dateDebut;
|
||||
|
||||
private LocalDate dateFin;
|
||||
|
||||
private TypePlanning typePlanning;
|
||||
|
||||
private StatutPlanning statutPlanning;
|
||||
|
||||
private Integer versionPlanning;
|
||||
|
||||
private UUID planningParentId;
|
||||
|
||||
private String planificateur;
|
||||
|
||||
private String valideur;
|
||||
|
||||
private LocalDateTime dateValidation;
|
||||
|
||||
private String commentairesValidation;
|
||||
|
||||
private Boolean conflitsDetectes;
|
||||
|
||||
private Integer nombreConflits;
|
||||
|
||||
private LocalDateTime derniereVerificationConflits;
|
||||
|
||||
private Boolean resolutionConflitsAuto;
|
||||
|
||||
private Double tauxUtilisationPrevu;
|
||||
|
||||
private Double scoreOptimisation;
|
||||
|
||||
private Boolean optimiseAutomatiquement;
|
||||
|
||||
private LocalDateTime derniereOptimisation;
|
||||
|
||||
private Boolean notificationsActivees;
|
||||
|
||||
private Boolean alerteConflits;
|
||||
|
||||
private Boolean alerteSurcharge;
|
||||
|
||||
private Double seuilAlerteUtilisation;
|
||||
|
||||
private String couleurPlanning;
|
||||
|
||||
private VuePlanning vueParDefaut;
|
||||
|
||||
private String granulariteAffichage;
|
||||
|
||||
private String optionsAffichage;
|
||||
|
||||
private String reglesPlanification;
|
||||
|
||||
private LocalDateTime dateCreation;
|
||||
|
||||
private LocalDateTime dateModification;
|
||||
|
||||
private String creePar;
|
||||
|
||||
private String modifiePar;
|
||||
|
||||
private Boolean actif;
|
||||
|
||||
// Relations simplifiées
|
||||
private UUID materielId;
|
||||
private String materielNom;
|
||||
|
||||
private Integer nombreReservations;
|
||||
|
||||
// Métadonnées calculées
|
||||
private Long dureePlanningJours;
|
||||
|
||||
private Boolean estValide;
|
||||
|
||||
private Boolean peutEtreModifie;
|
||||
|
||||
private Boolean necessiteAttention;
|
||||
|
||||
private String couleurAffichage;
|
||||
|
||||
private String iconeTypePlanning;
|
||||
|
||||
private Double pourcentageAvancement;
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.StatutPlanning;
|
||||
import dev.lions.btpxpress.domain.core.entity.TypePlanning;
|
||||
import dev.lions.btpxpress.domain.core.entity.VuePlanning;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la réponse d'un planning de matériel - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PlanningMaterielResponseDTO {
|
||||
|
||||
private UUID id;
|
||||
|
||||
private String nomPlanning;
|
||||
|
||||
private String descriptionPlanning;
|
||||
|
||||
private LocalDate dateDebut;
|
||||
|
||||
private LocalDate dateFin;
|
||||
|
||||
private TypePlanning typePlanning;
|
||||
|
||||
private StatutPlanning statutPlanning;
|
||||
|
||||
private Integer versionPlanning;
|
||||
|
||||
private UUID planningParentId;
|
||||
|
||||
private String planificateur;
|
||||
|
||||
private String valideur;
|
||||
|
||||
private LocalDateTime dateValidation;
|
||||
|
||||
private String commentairesValidation;
|
||||
|
||||
private Boolean conflitsDetectes;
|
||||
|
||||
private Integer nombreConflits;
|
||||
|
||||
private LocalDateTime derniereVerificationConflits;
|
||||
|
||||
private Boolean resolutionConflitsAuto;
|
||||
|
||||
private Double tauxUtilisationPrevu;
|
||||
|
||||
private Double scoreOptimisation;
|
||||
|
||||
private Boolean optimiseAutomatiquement;
|
||||
|
||||
private LocalDateTime derniereOptimisation;
|
||||
|
||||
private Boolean notificationsActivees;
|
||||
|
||||
private Boolean alerteConflits;
|
||||
|
||||
private Boolean alerteSurcharge;
|
||||
|
||||
private Double seuilAlerteUtilisation;
|
||||
|
||||
private String couleurPlanning;
|
||||
|
||||
private VuePlanning vueParDefaut;
|
||||
|
||||
private String granulariteAffichage;
|
||||
|
||||
private String optionsAffichage;
|
||||
|
||||
private String reglesPlanification;
|
||||
|
||||
private LocalDateTime dateCreation;
|
||||
|
||||
private LocalDateTime dateModification;
|
||||
|
||||
private String creePar;
|
||||
|
||||
private String modifiePar;
|
||||
|
||||
private Boolean actif;
|
||||
|
||||
// Relations simplifiées
|
||||
private UUID materielId;
|
||||
private String materielNom;
|
||||
|
||||
private Integer nombreReservations;
|
||||
|
||||
// Métadonnées calculées
|
||||
private Long dureePlanningJours;
|
||||
|
||||
private Boolean estValide;
|
||||
|
||||
private Boolean peutEtreModifie;
|
||||
|
||||
private Boolean necessiteAttention;
|
||||
|
||||
private String couleurAffichage;
|
||||
|
||||
private String iconeTypePlanning;
|
||||
|
||||
private Double pourcentageAvancement;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,76 +1,76 @@
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.PrioriteReservation;
|
||||
import dev.lions.btpxpress.domain.core.entity.StatutReservationMateriel;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la création d'une réservation de matériel - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ReservationMaterielCreateDTO {
|
||||
|
||||
@NotNull(message = "Le matériel est obligatoire")
|
||||
private UUID materielId;
|
||||
|
||||
@NotNull(message = "Le chantier est obligatoire")
|
||||
private UUID chantierId;
|
||||
|
||||
private UUID phaseId;
|
||||
|
||||
private UUID planningMaterielId;
|
||||
|
||||
@NotNull(message = "La date de début est obligatoire")
|
||||
private LocalDate dateDebut;
|
||||
|
||||
@NotNull(message = "La date de fin est obligatoire")
|
||||
private LocalDate dateFin;
|
||||
|
||||
private Integer heureDebut;
|
||||
|
||||
private Integer heureFin;
|
||||
|
||||
@NotNull(message = "La quantité est obligatoire")
|
||||
private BigDecimal quantite;
|
||||
|
||||
private String unite;
|
||||
|
||||
private BigDecimal prixUnitairePrevisionnel;
|
||||
|
||||
private BigDecimal prixTotalPrevisionnel;
|
||||
|
||||
private StatutReservationMateriel statut;
|
||||
|
||||
private PrioriteReservation priorite;
|
||||
|
||||
private String lieuLivraison;
|
||||
|
||||
private String instructionsLivraison;
|
||||
|
||||
private String responsableReception;
|
||||
|
||||
private String telephoneContact;
|
||||
|
||||
private LocalDate dateLivraisonPrevue;
|
||||
|
||||
private LocalDate dateRetourPrevue;
|
||||
|
||||
private String demandeur;
|
||||
|
||||
private String valideur;
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.PrioriteReservation;
|
||||
import dev.lions.btpxpress.domain.core.entity.StatutReservationMateriel;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la création d'une réservation de matériel - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ReservationMaterielCreateDTO {
|
||||
|
||||
@NotNull(message = "Le matériel est obligatoire")
|
||||
private UUID materielId;
|
||||
|
||||
@NotNull(message = "Le chantier est obligatoire")
|
||||
private UUID chantierId;
|
||||
|
||||
private UUID phaseId;
|
||||
|
||||
private UUID planningMaterielId;
|
||||
|
||||
@NotNull(message = "La date de début est obligatoire")
|
||||
private LocalDate dateDebut;
|
||||
|
||||
@NotNull(message = "La date de fin est obligatoire")
|
||||
private LocalDate dateFin;
|
||||
|
||||
private Integer heureDebut;
|
||||
|
||||
private Integer heureFin;
|
||||
|
||||
@NotNull(message = "La quantité est obligatoire")
|
||||
private BigDecimal quantite;
|
||||
|
||||
private String unite;
|
||||
|
||||
private BigDecimal prixUnitairePrevisionnel;
|
||||
|
||||
private BigDecimal prixTotalPrevisionnel;
|
||||
|
||||
private StatutReservationMateriel statut;
|
||||
|
||||
private PrioriteReservation priorite;
|
||||
|
||||
private String lieuLivraison;
|
||||
|
||||
private String instructionsLivraison;
|
||||
|
||||
private String responsableReception;
|
||||
|
||||
private String telephoneContact;
|
||||
|
||||
private LocalDate dateLivraisonPrevue;
|
||||
|
||||
private LocalDate dateRetourPrevue;
|
||||
|
||||
private String demandeur;
|
||||
|
||||
private String valideur;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,127 +1,127 @@
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.PrioriteReservation;
|
||||
import dev.lions.btpxpress.domain.core.entity.StatutReservationMateriel;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la réponse d'une réservation de matériel - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ReservationMaterielResponseDTO {
|
||||
|
||||
private UUID id;
|
||||
|
||||
private LocalDate dateDebut;
|
||||
|
||||
private LocalDate dateFin;
|
||||
|
||||
private Integer heureDebut;
|
||||
|
||||
private Integer heureFin;
|
||||
|
||||
private BigDecimal quantite;
|
||||
|
||||
private String unite;
|
||||
|
||||
private BigDecimal prixUnitairePrevisionnel;
|
||||
|
||||
private BigDecimal prixTotalPrevisionnel;
|
||||
|
||||
private BigDecimal prixUnitaireReel;
|
||||
|
||||
private BigDecimal prixTotalReel;
|
||||
|
||||
private StatutReservationMateriel statut;
|
||||
|
||||
private PrioriteReservation priorite;
|
||||
|
||||
private String referenceReservation;
|
||||
|
||||
private String lieuLivraison;
|
||||
|
||||
private String instructionsLivraison;
|
||||
|
||||
private String responsableReception;
|
||||
|
||||
private String telephoneContact;
|
||||
|
||||
private LocalDate dateLivraisonPrevue;
|
||||
|
||||
private LocalDate dateLivraisonReelle;
|
||||
|
||||
private LocalDate dateRetourPrevue;
|
||||
|
||||
private LocalDate dateRetourReelle;
|
||||
|
||||
private String observationsLivraison;
|
||||
|
||||
private String observationsRetour;
|
||||
|
||||
private String etatMaterielLivraison;
|
||||
|
||||
private String etatMaterielRetour;
|
||||
|
||||
private Integer kilometrageDebut;
|
||||
|
||||
private Integer kilometrageFin;
|
||||
|
||||
private String demandeur;
|
||||
|
||||
private String valideur;
|
||||
|
||||
private LocalDateTime dateValidation;
|
||||
|
||||
private String motifRefus;
|
||||
|
||||
private String numeroFactureFournisseur;
|
||||
|
||||
private LocalDate dateFactureFournisseur;
|
||||
|
||||
private Boolean factureTraitee;
|
||||
|
||||
private LocalDateTime dateCreation;
|
||||
|
||||
private LocalDateTime dateModification;
|
||||
|
||||
private String creePar;
|
||||
|
||||
private String modifiePar;
|
||||
|
||||
private Boolean actif;
|
||||
|
||||
// Relations simplifiées
|
||||
private UUID materielId;
|
||||
private String materielNom;
|
||||
private String materielReference;
|
||||
|
||||
private UUID chantierId;
|
||||
private String chantierNom;
|
||||
|
||||
private UUID phaseId;
|
||||
private String phaseNom;
|
||||
|
||||
private UUID planningMaterielId;
|
||||
|
||||
// Métadonnées calculées
|
||||
private Long dureeReservationJours;
|
||||
|
||||
private Boolean estEnCours;
|
||||
|
||||
private Boolean estEnRetard;
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.PrioriteReservation;
|
||||
import dev.lions.btpxpress.domain.core.entity.StatutReservationMateriel;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la réponse d'une réservation de matériel - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ReservationMaterielResponseDTO {
|
||||
|
||||
private UUID id;
|
||||
|
||||
private LocalDate dateDebut;
|
||||
|
||||
private LocalDate dateFin;
|
||||
|
||||
private Integer heureDebut;
|
||||
|
||||
private Integer heureFin;
|
||||
|
||||
private BigDecimal quantite;
|
||||
|
||||
private String unite;
|
||||
|
||||
private BigDecimal prixUnitairePrevisionnel;
|
||||
|
||||
private BigDecimal prixTotalPrevisionnel;
|
||||
|
||||
private BigDecimal prixUnitaireReel;
|
||||
|
||||
private BigDecimal prixTotalReel;
|
||||
|
||||
private StatutReservationMateriel statut;
|
||||
|
||||
private PrioriteReservation priorite;
|
||||
|
||||
private String referenceReservation;
|
||||
|
||||
private String lieuLivraison;
|
||||
|
||||
private String instructionsLivraison;
|
||||
|
||||
private String responsableReception;
|
||||
|
||||
private String telephoneContact;
|
||||
|
||||
private LocalDate dateLivraisonPrevue;
|
||||
|
||||
private LocalDate dateLivraisonReelle;
|
||||
|
||||
private LocalDate dateRetourPrevue;
|
||||
|
||||
private LocalDate dateRetourReelle;
|
||||
|
||||
private String observationsLivraison;
|
||||
|
||||
private String observationsRetour;
|
||||
|
||||
private String etatMaterielLivraison;
|
||||
|
||||
private String etatMaterielRetour;
|
||||
|
||||
private Integer kilometrageDebut;
|
||||
|
||||
private Integer kilometrageFin;
|
||||
|
||||
private String demandeur;
|
||||
|
||||
private String valideur;
|
||||
|
||||
private LocalDateTime dateValidation;
|
||||
|
||||
private String motifRefus;
|
||||
|
||||
private String numeroFactureFournisseur;
|
||||
|
||||
private LocalDate dateFactureFournisseur;
|
||||
|
||||
private Boolean factureTraitee;
|
||||
|
||||
private LocalDateTime dateCreation;
|
||||
|
||||
private LocalDateTime dateModification;
|
||||
|
||||
private String creePar;
|
||||
|
||||
private String modifiePar;
|
||||
|
||||
private Boolean actif;
|
||||
|
||||
// Relations simplifiées
|
||||
private UUID materielId;
|
||||
private String materielNom;
|
||||
private String materielReference;
|
||||
|
||||
private UUID chantierId;
|
||||
private String chantierNom;
|
||||
|
||||
private UUID phaseId;
|
||||
private String phaseNom;
|
||||
|
||||
private UUID planningMaterielId;
|
||||
|
||||
// Métadonnées calculées
|
||||
private Long dureeReservationJours;
|
||||
|
||||
private Boolean estEnCours;
|
||||
|
||||
private Boolean estEnRetard;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,78 +1,78 @@
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.CategorieStock;
|
||||
import dev.lions.btpxpress.domain.core.entity.SousCategorieStock;
|
||||
import dev.lions.btpxpress.domain.core.entity.UniteMesure;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la création d'un stock - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class StockCreateDTO {
|
||||
|
||||
@NotBlank(message = "La référence est obligatoire")
|
||||
private String reference;
|
||||
|
||||
@NotBlank(message = "La désignation est obligatoire")
|
||||
private String designation;
|
||||
|
||||
private String description;
|
||||
|
||||
@NotNull(message = "La catégorie est obligatoire")
|
||||
private CategorieStock categorie;
|
||||
|
||||
private SousCategorieStock sousCategorie;
|
||||
|
||||
@NotNull(message = "L'unité de mesure est obligatoire")
|
||||
private UniteMesure uniteMesure;
|
||||
|
||||
private BigDecimal quantiteStock;
|
||||
|
||||
private BigDecimal quantiteMinimum;
|
||||
|
||||
private BigDecimal quantiteMaximum;
|
||||
|
||||
private BigDecimal prixUnitaireHT;
|
||||
|
||||
private BigDecimal tauxTVA;
|
||||
|
||||
private String emplacementStockage;
|
||||
|
||||
private String codeZone;
|
||||
|
||||
private String codeAllee;
|
||||
|
||||
private String codeEtagere;
|
||||
|
||||
// Relations
|
||||
private UUID fournisseurPrincipalId;
|
||||
|
||||
private UUID chantierId;
|
||||
|
||||
// Informations techniques
|
||||
private String marque;
|
||||
|
||||
private String modele;
|
||||
|
||||
private String referenceFournisseur;
|
||||
|
||||
private String codeBarre;
|
||||
|
||||
private String codeEAN;
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.CategorieStock;
|
||||
import dev.lions.btpxpress.domain.core.entity.SousCategorieStock;
|
||||
import dev.lions.btpxpress.domain.core.entity.UniteMesure;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la création d'un stock - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class StockCreateDTO {
|
||||
|
||||
@NotBlank(message = "La référence est obligatoire")
|
||||
private String reference;
|
||||
|
||||
@NotBlank(message = "La désignation est obligatoire")
|
||||
private String designation;
|
||||
|
||||
private String description;
|
||||
|
||||
@NotNull(message = "La catégorie est obligatoire")
|
||||
private CategorieStock categorie;
|
||||
|
||||
private SousCategorieStock sousCategorie;
|
||||
|
||||
@NotNull(message = "L'unité de mesure est obligatoire")
|
||||
private UniteMesure uniteMesure;
|
||||
|
||||
private BigDecimal quantiteStock;
|
||||
|
||||
private BigDecimal quantiteMinimum;
|
||||
|
||||
private BigDecimal quantiteMaximum;
|
||||
|
||||
private BigDecimal prixUnitaireHT;
|
||||
|
||||
private BigDecimal tauxTVA;
|
||||
|
||||
private String emplacementStockage;
|
||||
|
||||
private String codeZone;
|
||||
|
||||
private String codeAllee;
|
||||
|
||||
private String codeEtagere;
|
||||
|
||||
// Relations
|
||||
private UUID fournisseurPrincipalId;
|
||||
|
||||
private UUID chantierId;
|
||||
|
||||
// Informations techniques
|
||||
private String marque;
|
||||
|
||||
private String modele;
|
||||
|
||||
private String referenceFournisseur;
|
||||
|
||||
private String codeBarre;
|
||||
|
||||
private String codeEAN;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,116 +1,116 @@
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.CategorieStock;
|
||||
import dev.lions.btpxpress.domain.core.entity.SousCategorieStock;
|
||||
import dev.lions.btpxpress.domain.core.entity.StatutStock;
|
||||
import dev.lions.btpxpress.domain.core.entity.UniteMesure;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la réponse d'un stock - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class StockResponseDTO {
|
||||
|
||||
private UUID id;
|
||||
|
||||
private String reference;
|
||||
|
||||
private String designation;
|
||||
|
||||
private String description;
|
||||
|
||||
private CategorieStock categorie;
|
||||
|
||||
private SousCategorieStock sousCategorie;
|
||||
|
||||
private UniteMesure uniteMesure;
|
||||
|
||||
private BigDecimal quantiteStock;
|
||||
|
||||
private BigDecimal quantiteMinimum;
|
||||
|
||||
private BigDecimal quantiteMaximum;
|
||||
|
||||
private BigDecimal quantiteSecurite;
|
||||
|
||||
private BigDecimal quantiteReservee;
|
||||
|
||||
private BigDecimal quantiteEnCommande;
|
||||
|
||||
private BigDecimal prixUnitaireHT;
|
||||
|
||||
private BigDecimal coutMoyenPondere;
|
||||
|
||||
private BigDecimal coutDerniereEntree;
|
||||
|
||||
private BigDecimal tauxTVA;
|
||||
|
||||
private String emplacementStockage;
|
||||
|
||||
private String codeZone;
|
||||
|
||||
private String codeAllee;
|
||||
|
||||
private String codeEtagere;
|
||||
|
||||
private StatutStock statut;
|
||||
|
||||
private Boolean gestionParLot;
|
||||
|
||||
private Boolean traçabiliteRequise;
|
||||
|
||||
private Boolean articlePerissable;
|
||||
|
||||
private Boolean controleQualiteRequis;
|
||||
|
||||
private Boolean articleDangereux;
|
||||
|
||||
private String classeDanger;
|
||||
|
||||
// Relations simplifiées
|
||||
private UUID fournisseurPrincipalId;
|
||||
private String fournisseurPrincipalNom;
|
||||
|
||||
private UUID chantierId;
|
||||
private String chantierNom;
|
||||
|
||||
// Informations techniques
|
||||
private String marque;
|
||||
|
||||
private String modele;
|
||||
|
||||
private String referenceFournisseur;
|
||||
|
||||
private String codeBarre;
|
||||
|
||||
private String codeEAN;
|
||||
|
||||
// Métadonnées
|
||||
private LocalDateTime dateCreation;
|
||||
|
||||
private LocalDateTime dateModification;
|
||||
|
||||
private String creePar;
|
||||
|
||||
private String modifiePar;
|
||||
|
||||
// Calculs
|
||||
private BigDecimal valeurStock;
|
||||
|
||||
private Boolean enRupture;
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.CategorieStock;
|
||||
import dev.lions.btpxpress.domain.core.entity.SousCategorieStock;
|
||||
import dev.lions.btpxpress.domain.core.entity.StatutStock;
|
||||
import dev.lions.btpxpress.domain.core.entity.UniteMesure;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la réponse d'un stock - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class StockResponseDTO {
|
||||
|
||||
private UUID id;
|
||||
|
||||
private String reference;
|
||||
|
||||
private String designation;
|
||||
|
||||
private String description;
|
||||
|
||||
private CategorieStock categorie;
|
||||
|
||||
private SousCategorieStock sousCategorie;
|
||||
|
||||
private UniteMesure uniteMesure;
|
||||
|
||||
private BigDecimal quantiteStock;
|
||||
|
||||
private BigDecimal quantiteMinimum;
|
||||
|
||||
private BigDecimal quantiteMaximum;
|
||||
|
||||
private BigDecimal quantiteSecurite;
|
||||
|
||||
private BigDecimal quantiteReservee;
|
||||
|
||||
private BigDecimal quantiteEnCommande;
|
||||
|
||||
private BigDecimal prixUnitaireHT;
|
||||
|
||||
private BigDecimal coutMoyenPondere;
|
||||
|
||||
private BigDecimal coutDerniereEntree;
|
||||
|
||||
private BigDecimal tauxTVA;
|
||||
|
||||
private String emplacementStockage;
|
||||
|
||||
private String codeZone;
|
||||
|
||||
private String codeAllee;
|
||||
|
||||
private String codeEtagere;
|
||||
|
||||
private StatutStock statut;
|
||||
|
||||
private Boolean gestionParLot;
|
||||
|
||||
private Boolean traçabiliteRequise;
|
||||
|
||||
private Boolean articlePerissable;
|
||||
|
||||
private Boolean controleQualiteRequis;
|
||||
|
||||
private Boolean articleDangereux;
|
||||
|
||||
private String classeDanger;
|
||||
|
||||
// Relations simplifiées
|
||||
private UUID fournisseurPrincipalId;
|
||||
private String fournisseurPrincipalNom;
|
||||
|
||||
private UUID chantierId;
|
||||
private String chantierNom;
|
||||
|
||||
// Informations techniques
|
||||
private String marque;
|
||||
|
||||
private String modele;
|
||||
|
||||
private String referenceFournisseur;
|
||||
|
||||
private String codeBarre;
|
||||
|
||||
private String codeEAN;
|
||||
|
||||
// Métadonnées
|
||||
private LocalDateTime dateCreation;
|
||||
|
||||
private LocalDateTime dateModification;
|
||||
|
||||
private String creePar;
|
||||
|
||||
private String modifiePar;
|
||||
|
||||
// Calculs
|
||||
private BigDecimal valeurStock;
|
||||
|
||||
private Boolean enRupture;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,62 +1,62 @@
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.UserRole;
|
||||
import dev.lions.btpxpress.domain.core.entity.UserStatus;
|
||||
import jakarta.validation.constraints.Email;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la création d'un utilisateur - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class UserCreateDTO {
|
||||
|
||||
@NotBlank(message = "L'email est obligatoire")
|
||||
@Email(message = "Email invalide")
|
||||
private String email;
|
||||
|
||||
@NotBlank(message = "Le nom est obligatoire")
|
||||
private String nom;
|
||||
|
||||
@NotBlank(message = "Le prénom est obligatoire")
|
||||
private String prenom;
|
||||
|
||||
@NotBlank(message = "Le mot de passe est obligatoire")
|
||||
private String password;
|
||||
|
||||
private UserRole role;
|
||||
|
||||
private Boolean actif;
|
||||
|
||||
private UserStatus status;
|
||||
|
||||
private String telephone;
|
||||
|
||||
private String adresse;
|
||||
|
||||
private String codePostal;
|
||||
|
||||
private String ville;
|
||||
|
||||
private String entreprise;
|
||||
|
||||
private String siret;
|
||||
|
||||
private String secteurActivite;
|
||||
|
||||
private Integer effectif;
|
||||
|
||||
private String commentaireAdmin;
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.UserRole;
|
||||
import dev.lions.btpxpress.domain.core.entity.UserStatus;
|
||||
import jakarta.validation.constraints.Email;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la création d'un utilisateur - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class UserCreateDTO {
|
||||
|
||||
@NotBlank(message = "L'email est obligatoire")
|
||||
@Email(message = "Email invalide")
|
||||
private String email;
|
||||
|
||||
@NotBlank(message = "Le nom est obligatoire")
|
||||
private String nom;
|
||||
|
||||
@NotBlank(message = "Le prénom est obligatoire")
|
||||
private String prenom;
|
||||
|
||||
@NotBlank(message = "Le mot de passe est obligatoire")
|
||||
private String password;
|
||||
|
||||
private UserRole role;
|
||||
|
||||
private Boolean actif;
|
||||
|
||||
private UserStatus status;
|
||||
|
||||
private String telephone;
|
||||
|
||||
private String adresse;
|
||||
|
||||
private String codePostal;
|
||||
|
||||
private String ville;
|
||||
|
||||
private String entreprise;
|
||||
|
||||
private String siret;
|
||||
|
||||
private String secteurActivite;
|
||||
|
||||
private Integer effectif;
|
||||
|
||||
private String commentaireAdmin;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,67 +1,67 @@
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.UserRole;
|
||||
import dev.lions.btpxpress.domain.core.entity.UserStatus;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la réponse d'un utilisateur - Architecture 2025
|
||||
* Note: Le mot de passe n'est jamais inclus dans ce DTO pour des raisons de sécurité
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class UserResponseDTO {
|
||||
|
||||
private UUID id;
|
||||
|
||||
private String email;
|
||||
|
||||
private String nom;
|
||||
|
||||
private String prenom;
|
||||
|
||||
private UserRole role;
|
||||
|
||||
private Boolean actif;
|
||||
|
||||
private UserStatus status;
|
||||
|
||||
private String telephone;
|
||||
|
||||
private String adresse;
|
||||
|
||||
private String codePostal;
|
||||
|
||||
private String ville;
|
||||
|
||||
private String entreprise;
|
||||
|
||||
private String siret;
|
||||
|
||||
private String secteurActivite;
|
||||
|
||||
private Integer effectif;
|
||||
|
||||
private String commentaireAdmin;
|
||||
|
||||
private LocalDateTime dateCreation;
|
||||
|
||||
private LocalDateTime dateModification;
|
||||
|
||||
private LocalDateTime derniereConnexion;
|
||||
|
||||
// Métadonnées calculées
|
||||
private Boolean canLogin;
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.dto;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.UserRole;
|
||||
import dev.lions.btpxpress.domain.core.entity.UserStatus;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.UUID;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* DTO pour la réponse d'un utilisateur - Architecture 2025
|
||||
* Note: Le mot de passe n'est jamais inclus dans ce DTO pour des raisons de sécurité
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class UserResponseDTO {
|
||||
|
||||
private UUID id;
|
||||
|
||||
private String email;
|
||||
|
||||
private String nom;
|
||||
|
||||
private String prenom;
|
||||
|
||||
private UserRole role;
|
||||
|
||||
private Boolean actif;
|
||||
|
||||
private UserStatus status;
|
||||
|
||||
private String telephone;
|
||||
|
||||
private String adresse;
|
||||
|
||||
private String codePostal;
|
||||
|
||||
private String ville;
|
||||
|
||||
private String entreprise;
|
||||
|
||||
private String siret;
|
||||
|
||||
private String secteurActivite;
|
||||
|
||||
private Integer effectif;
|
||||
|
||||
private String commentaireAdmin;
|
||||
|
||||
private LocalDateTime dateCreation;
|
||||
|
||||
private LocalDateTime dateModification;
|
||||
|
||||
private LocalDateTime derniereConnexion;
|
||||
|
||||
// Métadonnées calculées
|
||||
private Boolean canLogin;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,94 +1,94 @@
|
||||
package dev.lions.btpxpress.domain.shared.mapper;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.Abonnement;
|
||||
import dev.lions.btpxpress.domain.core.entity.EntrepriseProfile;
|
||||
import dev.lions.btpxpress.domain.shared.dto.AbonnementCreateDTO;
|
||||
import dev.lions.btpxpress.domain.shared.dto.AbonnementResponseDTO;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
|
||||
/**
|
||||
* Mapper pour les abonnements - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@ApplicationScoped
|
||||
public class AbonnementMapper {
|
||||
|
||||
/**
|
||||
* Conversion DTO vers entité
|
||||
*/
|
||||
public Abonnement toEntity(AbonnementCreateDTO dto) {
|
||||
if (dto == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Abonnement abonnement = new Abonnement();
|
||||
|
||||
// Créer une EntrepriseProfile avec juste l'ID (le service chargera l'entité complète)
|
||||
if (dto.getEntrepriseId() != null) {
|
||||
EntrepriseProfile entreprise = new EntrepriseProfile();
|
||||
entreprise.setId(dto.getEntrepriseId());
|
||||
abonnement.setEntreprise(entreprise);
|
||||
}
|
||||
|
||||
abonnement.setTypeAbonnement(dto.getTypeAbonnement());
|
||||
abonnement.setStatut(dto.getStatut() != null ? dto.getStatut() : dev.lions.btpxpress.domain.core.entity.StatutAbonnement.ACTIF);
|
||||
abonnement.setDateDebut(dto.getDateDebut());
|
||||
abonnement.setDateFin(dto.getDateFin());
|
||||
abonnement.setPrixPaye(dto.getPrixPaye());
|
||||
abonnement.setMethodePaiement(dto.getMethodePaiement());
|
||||
abonnement.setAutoRenouvellement(dto.getAutoRenouvellement() != null ? dto.getAutoRenouvellement() : true);
|
||||
abonnement.setReferencePaiement(dto.getReferencePaiement());
|
||||
abonnement.setDateDerniereFacture(dto.getDateDerniereFacture());
|
||||
abonnement.setDateProchainPrelevement(dto.getDateProchainPrelevement());
|
||||
abonnement.setMisesEnRelationUtilisees(dto.getMisesEnRelationUtilisees() != null ? dto.getMisesEnRelationUtilisees() : 0);
|
||||
abonnement.setNotes(dto.getNotes());
|
||||
|
||||
return abonnement;
|
||||
}
|
||||
|
||||
/**
|
||||
* Conversion entité vers ResponseDTO
|
||||
*/
|
||||
public AbonnementResponseDTO toResponseDTO(Abonnement abonnement) {
|
||||
if (abonnement == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
AbonnementResponseDTO dto = AbonnementResponseDTO.builder()
|
||||
.id(abonnement.getId())
|
||||
.typeAbonnement(abonnement.getTypeAbonnement())
|
||||
.statut(abonnement.getStatut())
|
||||
.dateDebut(abonnement.getDateDebut())
|
||||
.dateFin(abonnement.getDateFin())
|
||||
.prixPaye(abonnement.getPrixPaye())
|
||||
.methodePaiement(abonnement.getMethodePaiement())
|
||||
.autoRenouvellement(abonnement.isAutoRenouvellement())
|
||||
.referencePaiement(abonnement.getReferencePaiement())
|
||||
.dateDerniereFacture(abonnement.getDateDerniereFacture())
|
||||
.dateProchainPrelevement(abonnement.getDateProchainPrelevement())
|
||||
.misesEnRelationUtilisees(abonnement.getMisesEnRelationUtilisees())
|
||||
.dateCreation(abonnement.getDateCreation())
|
||||
.dateModification(abonnement.getDateModification())
|
||||
.notes(abonnement.getNotes())
|
||||
.build();
|
||||
|
||||
// Relations simplifiées
|
||||
if (abonnement.getEntreprise() != null) {
|
||||
dto.setEntrepriseId(abonnement.getEntreprise().getId());
|
||||
dto.setEntrepriseNomCommercial(abonnement.getEntreprise().getNomCommercial());
|
||||
}
|
||||
|
||||
// Métadonnées calculées
|
||||
dto.setEstActif(abonnement.estActif());
|
||||
dto.setEstExpire(abonnement.estExpire());
|
||||
dto.setBientotExpire(abonnement.bientotExpire());
|
||||
dto.setJoursRestants(abonnement.joursRestants());
|
||||
dto.setLimiteMisesEnRelationAtteinte(abonnement.limiteMisesEnRelationAtteinte());
|
||||
|
||||
return dto;
|
||||
}
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.mapper;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.Abonnement;
|
||||
import dev.lions.btpxpress.domain.core.entity.EntrepriseProfile;
|
||||
import dev.lions.btpxpress.domain.shared.dto.AbonnementCreateDTO;
|
||||
import dev.lions.btpxpress.domain.shared.dto.AbonnementResponseDTO;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
|
||||
/**
|
||||
* Mapper pour les abonnements - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@ApplicationScoped
|
||||
public class AbonnementMapper {
|
||||
|
||||
/**
|
||||
* Conversion DTO vers entité
|
||||
*/
|
||||
public Abonnement toEntity(AbonnementCreateDTO dto) {
|
||||
if (dto == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Abonnement abonnement = new Abonnement();
|
||||
|
||||
// Créer une EntrepriseProfile avec juste l'ID (le service chargera l'entité complète)
|
||||
if (dto.getEntrepriseId() != null) {
|
||||
EntrepriseProfile entreprise = new EntrepriseProfile();
|
||||
entreprise.setId(dto.getEntrepriseId());
|
||||
abonnement.setEntreprise(entreprise);
|
||||
}
|
||||
|
||||
abonnement.setTypeAbonnement(dto.getTypeAbonnement());
|
||||
abonnement.setStatut(dto.getStatut() != null ? dto.getStatut() : dev.lions.btpxpress.domain.core.entity.StatutAbonnement.ACTIF);
|
||||
abonnement.setDateDebut(dto.getDateDebut());
|
||||
abonnement.setDateFin(dto.getDateFin());
|
||||
abonnement.setPrixPaye(dto.getPrixPaye());
|
||||
abonnement.setMethodePaiement(dto.getMethodePaiement());
|
||||
abonnement.setAutoRenouvellement(dto.getAutoRenouvellement() != null ? dto.getAutoRenouvellement() : true);
|
||||
abonnement.setReferencePaiement(dto.getReferencePaiement());
|
||||
abonnement.setDateDerniereFacture(dto.getDateDerniereFacture());
|
||||
abonnement.setDateProchainPrelevement(dto.getDateProchainPrelevement());
|
||||
abonnement.setMisesEnRelationUtilisees(dto.getMisesEnRelationUtilisees() != null ? dto.getMisesEnRelationUtilisees() : 0);
|
||||
abonnement.setNotes(dto.getNotes());
|
||||
|
||||
return abonnement;
|
||||
}
|
||||
|
||||
/**
|
||||
* Conversion entité vers ResponseDTO
|
||||
*/
|
||||
public AbonnementResponseDTO toResponseDTO(Abonnement abonnement) {
|
||||
if (abonnement == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
AbonnementResponseDTO dto = AbonnementResponseDTO.builder()
|
||||
.id(abonnement.getId())
|
||||
.typeAbonnement(abonnement.getTypeAbonnement())
|
||||
.statut(abonnement.getStatut())
|
||||
.dateDebut(abonnement.getDateDebut())
|
||||
.dateFin(abonnement.getDateFin())
|
||||
.prixPaye(abonnement.getPrixPaye())
|
||||
.methodePaiement(abonnement.getMethodePaiement())
|
||||
.autoRenouvellement(abonnement.isAutoRenouvellement())
|
||||
.referencePaiement(abonnement.getReferencePaiement())
|
||||
.dateDerniereFacture(abonnement.getDateDerniereFacture())
|
||||
.dateProchainPrelevement(abonnement.getDateProchainPrelevement())
|
||||
.misesEnRelationUtilisees(abonnement.getMisesEnRelationUtilisees())
|
||||
.dateCreation(abonnement.getDateCreation())
|
||||
.dateModification(abonnement.getDateModification())
|
||||
.notes(abonnement.getNotes())
|
||||
.build();
|
||||
|
||||
// Relations simplifiées
|
||||
if (abonnement.getEntreprise() != null) {
|
||||
dto.setEntrepriseId(abonnement.getEntreprise().getId());
|
||||
dto.setEntrepriseNomCommercial(abonnement.getEntreprise().getNomCommercial());
|
||||
}
|
||||
|
||||
// Métadonnées calculées
|
||||
dto.setEstActif(abonnement.estActif());
|
||||
dto.setEstExpire(abonnement.estExpire());
|
||||
dto.setBientotExpire(abonnement.bientotExpire());
|
||||
dto.setJoursRestants(abonnement.joursRestants());
|
||||
dto.setLimiteMisesEnRelationAtteinte(abonnement.limiteMisesEnRelationAtteinte());
|
||||
|
||||
return dto;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,146 +1,146 @@
|
||||
package dev.lions.btpxpress.domain.shared.mapper;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.BonCommande;
|
||||
import dev.lions.btpxpress.domain.shared.dto.BonCommandeCreateDTO;
|
||||
import dev.lions.btpxpress.domain.shared.dto.BonCommandeResponseDTO;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
|
||||
/**
|
||||
* Mapper pour les bons de commande - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@ApplicationScoped
|
||||
public class BonCommandeMapper {
|
||||
|
||||
/**
|
||||
* Conversion DTO vers entité
|
||||
*/
|
||||
public BonCommande toEntity(BonCommandeCreateDTO dto) {
|
||||
if (dto == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
BonCommande bonCommande = new BonCommande();
|
||||
bonCommande.setNumero(dto.getNumero());
|
||||
bonCommande.setNumeroInterne(dto.getNumeroInterne());
|
||||
bonCommande.setObjet(dto.getObjet());
|
||||
bonCommande.setDescription(dto.getDescription());
|
||||
bonCommande.setPriorite(dto.getPriorite() != null ? dto.getPriorite() : dev.lions.btpxpress.domain.core.entity.PrioriteBonCommande.NORMALE);
|
||||
bonCommande.setTypeCommande(dto.getTypeCommande() != null ? dto.getTypeCommande() : dev.lions.btpxpress.domain.core.entity.TypeBonCommande.ACHAT);
|
||||
bonCommande.setDateCommande(dto.getDateCommande());
|
||||
bonCommande.setDateBesoin(dto.getDateBesoin());
|
||||
bonCommande.setDateLivraisonPrevue(dto.getDateLivraisonPrevue());
|
||||
bonCommande.setMontantHT(dto.getMontantHT());
|
||||
bonCommande.setRemisePourcentage(dto.getRemisePourcentage());
|
||||
bonCommande.setRemiseMontant(dto.getRemiseMontant());
|
||||
bonCommande.setFraisPort(dto.getFraisPort());
|
||||
bonCommande.setAdresseLivraison(dto.getAdresseLivraison());
|
||||
bonCommande.setAdresseFacturation(dto.getAdresseFacturation());
|
||||
bonCommande.setContactFournisseur(dto.getContactFournisseur());
|
||||
bonCommande.setEmailContact(dto.getEmailContact());
|
||||
bonCommande.setTelephoneContact(dto.getTelephoneContact());
|
||||
bonCommande.setReferenceFournisseur(dto.getReferenceFournisseur());
|
||||
bonCommande.setNumeroDevis(dto.getNumeroDevis());
|
||||
bonCommande.setLivraisonPartielleAutorisee(dto.getLivraisonPartielleAutorisee() != null ? dto.getLivraisonPartielleAutorisee() : true);
|
||||
bonCommande.setControleReceptionRequis(dto.getControleReceptionRequis() != null ? dto.getControleReceptionRequis() : false);
|
||||
bonCommande.setUrgente(dto.getUrgente() != null ? dto.getUrgente() : false);
|
||||
bonCommande.setConfidentielle(dto.getConfidentielle() != null ? dto.getConfidentielle() : false);
|
||||
bonCommande.setCommentaires(dto.getCommentaires());
|
||||
bonCommande.setNotesInternes(dto.getNotesInternes());
|
||||
|
||||
return bonCommande;
|
||||
}
|
||||
|
||||
/**
|
||||
* Conversion entité vers ResponseDTO
|
||||
*/
|
||||
public BonCommandeResponseDTO toResponseDTO(BonCommande bonCommande) {
|
||||
if (bonCommande == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
BonCommandeResponseDTO dto = BonCommandeResponseDTO.builder()
|
||||
.id(bonCommande.getId())
|
||||
.numero(bonCommande.getNumero())
|
||||
.numeroInterne(bonCommande.getNumeroInterne())
|
||||
.objet(bonCommande.getObjet())
|
||||
.description(bonCommande.getDescription())
|
||||
.statut(bonCommande.getStatut())
|
||||
.priorite(bonCommande.getPriorite())
|
||||
.typeCommande(bonCommande.getTypeCommande())
|
||||
.dateCommande(bonCommande.getDateCommande())
|
||||
.dateBesoin(bonCommande.getDateBesoin())
|
||||
.dateLivraisonPrevue(bonCommande.getDateLivraisonPrevue())
|
||||
.dateLivraisonReelle(bonCommande.getDateLivraisonReelle())
|
||||
.dateValidation(bonCommande.getDateValidation())
|
||||
.dateEnvoi(bonCommande.getDateEnvoi())
|
||||
.dateAccuseReception(bonCommande.getDateAccuseReception())
|
||||
.montantHT(bonCommande.getMontantHT())
|
||||
.montantTVA(bonCommande.getMontantTVA())
|
||||
.montantTTC(bonCommande.getMontantTTC())
|
||||
.remisePourcentage(bonCommande.getRemisePourcentage())
|
||||
.remiseMontant(bonCommande.getRemiseMontant())
|
||||
.fraisPort(bonCommande.getFraisPort())
|
||||
.autreFrais(bonCommande.getAutreFrais())
|
||||
.adresseLivraison(bonCommande.getAdresseLivraison())
|
||||
.adresseFacturation(bonCommande.getAdresseFacturation())
|
||||
.contactFournisseur(bonCommande.getContactFournisseur())
|
||||
.emailContact(bonCommande.getEmailContact())
|
||||
.telephoneContact(bonCommande.getTelephoneContact())
|
||||
.referenceFournisseur(bonCommande.getReferenceFournisseur())
|
||||
.numeroDevis(bonCommande.getNumeroDevis())
|
||||
.referenceMarche(bonCommande.getReferenceMarche())
|
||||
.livraisonPartielleAutorisee(bonCommande.getLivraisonPartielleAutorisee())
|
||||
.controleReceptionRequis(bonCommande.getControleReceptionRequis())
|
||||
.urgente(bonCommande.getUrgente())
|
||||
.confidentielle(bonCommande.getConfidentielle())
|
||||
.factureRecue(bonCommande.getFactureRecue())
|
||||
.dateReceptionFacture(bonCommande.getDateReceptionFacture())
|
||||
.numeroFacture(bonCommande.getNumeroFacture())
|
||||
.commentaires(bonCommande.getCommentaires())
|
||||
.notesInternes(bonCommande.getNotesInternes())
|
||||
.conditionsParticulieres(bonCommande.getConditionsParticulieres())
|
||||
.motifAnnulation(bonCommande.getMotifAnnulation())
|
||||
.dateCreation(bonCommande.getDateCreation())
|
||||
.dateModification(bonCommande.getDateModification())
|
||||
.creePar(bonCommande.getCreePar())
|
||||
.modifiePar(bonCommande.getModifiePar())
|
||||
.validePar(bonCommande.getValidePar())
|
||||
.envoyePar(bonCommande.getEnvoyePar())
|
||||
.build();
|
||||
|
||||
// Relations simplifiées
|
||||
if (bonCommande.getFournisseur() != null) {
|
||||
dto.setFournisseurId(bonCommande.getFournisseur().getId());
|
||||
dto.setFournisseurNom(bonCommande.getFournisseur().getNom());
|
||||
}
|
||||
|
||||
if (bonCommande.getChantier() != null) {
|
||||
dto.setChantierId(bonCommande.getChantier().getId());
|
||||
dto.setChantierNom(bonCommande.getChantier().getNom());
|
||||
}
|
||||
|
||||
if (bonCommande.getDemandeur() != null) {
|
||||
dto.setDemandeurId(bonCommande.getDemandeur().getId());
|
||||
dto.setDemandeurNom(bonCommande.getDemandeur().getNomComplet());
|
||||
}
|
||||
|
||||
if (bonCommande.getValideur() != null) {
|
||||
dto.setValideurId(bonCommande.getValideur().getId());
|
||||
dto.setValideurNom(bonCommande.getValideur().getNomComplet());
|
||||
}
|
||||
|
||||
// Compter les lignes
|
||||
if (bonCommande.getLignes() != null) {
|
||||
dto.setNombreLignes(bonCommande.getLignes().size());
|
||||
} else {
|
||||
dto.setNombreLignes(0);
|
||||
}
|
||||
|
||||
return dto;
|
||||
}
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.mapper;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.BonCommande;
|
||||
import dev.lions.btpxpress.domain.shared.dto.BonCommandeCreateDTO;
|
||||
import dev.lions.btpxpress.domain.shared.dto.BonCommandeResponseDTO;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
|
||||
/**
|
||||
* Mapper pour les bons de commande - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@ApplicationScoped
|
||||
public class BonCommandeMapper {
|
||||
|
||||
/**
|
||||
* Conversion DTO vers entité
|
||||
*/
|
||||
public BonCommande toEntity(BonCommandeCreateDTO dto) {
|
||||
if (dto == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
BonCommande bonCommande = new BonCommande();
|
||||
bonCommande.setNumero(dto.getNumero());
|
||||
bonCommande.setNumeroInterne(dto.getNumeroInterne());
|
||||
bonCommande.setObjet(dto.getObjet());
|
||||
bonCommande.setDescription(dto.getDescription());
|
||||
bonCommande.setPriorite(dto.getPriorite() != null ? dto.getPriorite() : dev.lions.btpxpress.domain.core.entity.PrioriteBonCommande.NORMALE);
|
||||
bonCommande.setTypeCommande(dto.getTypeCommande() != null ? dto.getTypeCommande() : dev.lions.btpxpress.domain.core.entity.TypeBonCommande.ACHAT);
|
||||
bonCommande.setDateCommande(dto.getDateCommande());
|
||||
bonCommande.setDateBesoin(dto.getDateBesoin());
|
||||
bonCommande.setDateLivraisonPrevue(dto.getDateLivraisonPrevue());
|
||||
bonCommande.setMontantHT(dto.getMontantHT());
|
||||
bonCommande.setRemisePourcentage(dto.getRemisePourcentage());
|
||||
bonCommande.setRemiseMontant(dto.getRemiseMontant());
|
||||
bonCommande.setFraisPort(dto.getFraisPort());
|
||||
bonCommande.setAdresseLivraison(dto.getAdresseLivraison());
|
||||
bonCommande.setAdresseFacturation(dto.getAdresseFacturation());
|
||||
bonCommande.setContactFournisseur(dto.getContactFournisseur());
|
||||
bonCommande.setEmailContact(dto.getEmailContact());
|
||||
bonCommande.setTelephoneContact(dto.getTelephoneContact());
|
||||
bonCommande.setReferenceFournisseur(dto.getReferenceFournisseur());
|
||||
bonCommande.setNumeroDevis(dto.getNumeroDevis());
|
||||
bonCommande.setLivraisonPartielleAutorisee(dto.getLivraisonPartielleAutorisee() != null ? dto.getLivraisonPartielleAutorisee() : true);
|
||||
bonCommande.setControleReceptionRequis(dto.getControleReceptionRequis() != null ? dto.getControleReceptionRequis() : false);
|
||||
bonCommande.setUrgente(dto.getUrgente() != null ? dto.getUrgente() : false);
|
||||
bonCommande.setConfidentielle(dto.getConfidentielle() != null ? dto.getConfidentielle() : false);
|
||||
bonCommande.setCommentaires(dto.getCommentaires());
|
||||
bonCommande.setNotesInternes(dto.getNotesInternes());
|
||||
|
||||
return bonCommande;
|
||||
}
|
||||
|
||||
/**
|
||||
* Conversion entité vers ResponseDTO
|
||||
*/
|
||||
public BonCommandeResponseDTO toResponseDTO(BonCommande bonCommande) {
|
||||
if (bonCommande == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
BonCommandeResponseDTO dto = BonCommandeResponseDTO.builder()
|
||||
.id(bonCommande.getId())
|
||||
.numero(bonCommande.getNumero())
|
||||
.numeroInterne(bonCommande.getNumeroInterne())
|
||||
.objet(bonCommande.getObjet())
|
||||
.description(bonCommande.getDescription())
|
||||
.statut(bonCommande.getStatut())
|
||||
.priorite(bonCommande.getPriorite())
|
||||
.typeCommande(bonCommande.getTypeCommande())
|
||||
.dateCommande(bonCommande.getDateCommande())
|
||||
.dateBesoin(bonCommande.getDateBesoin())
|
||||
.dateLivraisonPrevue(bonCommande.getDateLivraisonPrevue())
|
||||
.dateLivraisonReelle(bonCommande.getDateLivraisonReelle())
|
||||
.dateValidation(bonCommande.getDateValidation())
|
||||
.dateEnvoi(bonCommande.getDateEnvoi())
|
||||
.dateAccuseReception(bonCommande.getDateAccuseReception())
|
||||
.montantHT(bonCommande.getMontantHT())
|
||||
.montantTVA(bonCommande.getMontantTVA())
|
||||
.montantTTC(bonCommande.getMontantTTC())
|
||||
.remisePourcentage(bonCommande.getRemisePourcentage())
|
||||
.remiseMontant(bonCommande.getRemiseMontant())
|
||||
.fraisPort(bonCommande.getFraisPort())
|
||||
.autreFrais(bonCommande.getAutreFrais())
|
||||
.adresseLivraison(bonCommande.getAdresseLivraison())
|
||||
.adresseFacturation(bonCommande.getAdresseFacturation())
|
||||
.contactFournisseur(bonCommande.getContactFournisseur())
|
||||
.emailContact(bonCommande.getEmailContact())
|
||||
.telephoneContact(bonCommande.getTelephoneContact())
|
||||
.referenceFournisseur(bonCommande.getReferenceFournisseur())
|
||||
.numeroDevis(bonCommande.getNumeroDevis())
|
||||
.referenceMarche(bonCommande.getReferenceMarche())
|
||||
.livraisonPartielleAutorisee(bonCommande.getLivraisonPartielleAutorisee())
|
||||
.controleReceptionRequis(bonCommande.getControleReceptionRequis())
|
||||
.urgente(bonCommande.getUrgente())
|
||||
.confidentielle(bonCommande.getConfidentielle())
|
||||
.factureRecue(bonCommande.getFactureRecue())
|
||||
.dateReceptionFacture(bonCommande.getDateReceptionFacture())
|
||||
.numeroFacture(bonCommande.getNumeroFacture())
|
||||
.commentaires(bonCommande.getCommentaires())
|
||||
.notesInternes(bonCommande.getNotesInternes())
|
||||
.conditionsParticulieres(bonCommande.getConditionsParticulieres())
|
||||
.motifAnnulation(bonCommande.getMotifAnnulation())
|
||||
.dateCreation(bonCommande.getDateCreation())
|
||||
.dateModification(bonCommande.getDateModification())
|
||||
.creePar(bonCommande.getCreePar())
|
||||
.modifiePar(bonCommande.getModifiePar())
|
||||
.validePar(bonCommande.getValidePar())
|
||||
.envoyePar(bonCommande.getEnvoyePar())
|
||||
.build();
|
||||
|
||||
// Relations simplifiées
|
||||
if (bonCommande.getFournisseur() != null) {
|
||||
dto.setFournisseurId(bonCommande.getFournisseur().getId());
|
||||
dto.setFournisseurNom(bonCommande.getFournisseur().getNom());
|
||||
}
|
||||
|
||||
if (bonCommande.getChantier() != null) {
|
||||
dto.setChantierId(bonCommande.getChantier().getId());
|
||||
dto.setChantierNom(bonCommande.getChantier().getNom());
|
||||
}
|
||||
|
||||
if (bonCommande.getDemandeur() != null) {
|
||||
dto.setDemandeurId(bonCommande.getDemandeur().getId());
|
||||
dto.setDemandeurNom(bonCommande.getDemandeur().getNomComplet());
|
||||
}
|
||||
|
||||
if (bonCommande.getValideur() != null) {
|
||||
dto.setValideurId(bonCommande.getValideur().getId());
|
||||
dto.setValideurNom(bonCommande.getValideur().getNomComplet());
|
||||
}
|
||||
|
||||
// Compter les lignes
|
||||
if (bonCommande.getLignes() != null) {
|
||||
dto.setNombreLignes(bonCommande.getLignes().size());
|
||||
} else {
|
||||
dto.setNombreLignes(0);
|
||||
}
|
||||
|
||||
return dto;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,121 +1,121 @@
|
||||
package dev.lions.btpxpress.domain.shared.mapper;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.*;
|
||||
import dev.lions.btpxpress.domain.shared.dto.*;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
|
||||
/**
|
||||
* Mapper pour les budgets - Architecture 2025
|
||||
* Suit le même pattern que ChantierMapper et ClientMapper
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@ApplicationScoped
|
||||
public class BudgetMapper {
|
||||
|
||||
/**
|
||||
* Conversion DTO vers entité
|
||||
*
|
||||
* @param dto Le DTO de création
|
||||
* @param chantier Le chantier associé (chargé depuis le repository)
|
||||
* @return L'entité Budget créée
|
||||
*/
|
||||
public Budget toEntity(BudgetCreateDTO dto, Chantier chantier) {
|
||||
if (dto == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Budget budget = new Budget();
|
||||
budget.setChantier(chantier);
|
||||
budget.setBudgetTotal(dto.getBudgetTotal());
|
||||
budget.setDepenseReelle(dto.getDepenseReelle() != null ? dto.getDepenseReelle() : java.math.BigDecimal.ZERO);
|
||||
budget.setAvancementTravaux(dto.getAvancementTravaux());
|
||||
budget.setStatut(dto.getStatut());
|
||||
budget.setResponsable(dto.getResponsable());
|
||||
budget.setProchainJalon(dto.getProchainJalon());
|
||||
budget.setDateDerniereMiseAJour(dto.getDateDerniereMiseAJour());
|
||||
budget.setActif(true);
|
||||
|
||||
// Calculer l'écart (la méthode calculerEcart() sera appelée automatiquement par @PrePersist)
|
||||
return budget;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mise à jour d'entité depuis DTO
|
||||
*
|
||||
* @param budget L'entité à mettre à jour
|
||||
* @param dto Le DTO contenant les nouvelles valeurs
|
||||
* @param chantier Le chantier associé (peut être null si non modifié)
|
||||
*/
|
||||
public void updateEntity(Budget budget, BudgetCreateDTO dto, Chantier chantier) {
|
||||
if (budget == null || dto == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (dto.getBudgetTotal() != null) {
|
||||
budget.setBudgetTotal(dto.getBudgetTotal());
|
||||
}
|
||||
if (dto.getDepenseReelle() != null) {
|
||||
budget.setDepenseReelle(dto.getDepenseReelle());
|
||||
}
|
||||
if (dto.getAvancementTravaux() != null) {
|
||||
budget.setAvancementTravaux(dto.getAvancementTravaux());
|
||||
}
|
||||
if (dto.getStatut() != null) {
|
||||
budget.setStatut(dto.getStatut());
|
||||
}
|
||||
if (dto.getResponsable() != null) {
|
||||
budget.setResponsable(dto.getResponsable());
|
||||
}
|
||||
if (dto.getProchainJalon() != null) {
|
||||
budget.setProchainJalon(dto.getProchainJalon());
|
||||
}
|
||||
if (dto.getDateDerniereMiseAJour() != null) {
|
||||
budget.setDateDerniereMiseAJour(dto.getDateDerniereMiseAJour());
|
||||
}
|
||||
if (chantier != null) {
|
||||
budget.setChantier(chantier);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Conversion entité vers ResponseDTO
|
||||
*
|
||||
* @param budget L'entité Budget
|
||||
* @return Le DTO de réponse
|
||||
*/
|
||||
public BudgetResponseDTO toResponseDTO(Budget budget) {
|
||||
if (budget == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
BudgetResponseDTO dto = BudgetResponseDTO.builder()
|
||||
.id(budget.getId())
|
||||
.budgetTotal(budget.getBudgetTotal())
|
||||
.depenseReelle(budget.getDepenseReelle())
|
||||
.ecart(budget.getEcart())
|
||||
.ecartPourcentage(budget.getEcartPourcentage())
|
||||
.avancementTravaux(budget.getAvancementTravaux())
|
||||
.statut(budget.getStatut())
|
||||
.tendance(budget.getTendance())
|
||||
.responsable(budget.getResponsable())
|
||||
.nombreAlertes(budget.getNombreAlertes())
|
||||
.prochainJalon(budget.getProchainJalon())
|
||||
.dateDerniereMiseAJour(budget.getDateDerniereMiseAJour())
|
||||
.actif(budget.getActif())
|
||||
.dateCreation(budget.getDateCreation())
|
||||
.dateModification(budget.getDateModification())
|
||||
.build();
|
||||
|
||||
// Relations simplifiées
|
||||
if (budget.getChantier() != null) {
|
||||
dto.setChantierId(budget.getChantier().getId());
|
||||
dto.setChantierNom(budget.getChantier().getNom());
|
||||
}
|
||||
|
||||
return dto;
|
||||
}
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.mapper;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.*;
|
||||
import dev.lions.btpxpress.domain.shared.dto.*;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
|
||||
/**
|
||||
* Mapper pour les budgets - Architecture 2025
|
||||
* Suit le même pattern que ChantierMapper et ClientMapper
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@ApplicationScoped
|
||||
public class BudgetMapper {
|
||||
|
||||
/**
|
||||
* Conversion DTO vers entité
|
||||
*
|
||||
* @param dto Le DTO de création
|
||||
* @param chantier Le chantier associé (chargé depuis le repository)
|
||||
* @return L'entité Budget créée
|
||||
*/
|
||||
public Budget toEntity(BudgetCreateDTO dto, Chantier chantier) {
|
||||
if (dto == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Budget budget = new Budget();
|
||||
budget.setChantier(chantier);
|
||||
budget.setBudgetTotal(dto.getBudgetTotal());
|
||||
budget.setDepenseReelle(dto.getDepenseReelle() != null ? dto.getDepenseReelle() : java.math.BigDecimal.ZERO);
|
||||
budget.setAvancementTravaux(dto.getAvancementTravaux());
|
||||
budget.setStatut(dto.getStatut());
|
||||
budget.setResponsable(dto.getResponsable());
|
||||
budget.setProchainJalon(dto.getProchainJalon());
|
||||
budget.setDateDerniereMiseAJour(dto.getDateDerniereMiseAJour());
|
||||
budget.setActif(true);
|
||||
|
||||
// Calculer l'écart (la méthode calculerEcart() sera appelée automatiquement par @PrePersist)
|
||||
return budget;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mise à jour d'entité depuis DTO
|
||||
*
|
||||
* @param budget L'entité à mettre à jour
|
||||
* @param dto Le DTO contenant les nouvelles valeurs
|
||||
* @param chantier Le chantier associé (peut être null si non modifié)
|
||||
*/
|
||||
public void updateEntity(Budget budget, BudgetCreateDTO dto, Chantier chantier) {
|
||||
if (budget == null || dto == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (dto.getBudgetTotal() != null) {
|
||||
budget.setBudgetTotal(dto.getBudgetTotal());
|
||||
}
|
||||
if (dto.getDepenseReelle() != null) {
|
||||
budget.setDepenseReelle(dto.getDepenseReelle());
|
||||
}
|
||||
if (dto.getAvancementTravaux() != null) {
|
||||
budget.setAvancementTravaux(dto.getAvancementTravaux());
|
||||
}
|
||||
if (dto.getStatut() != null) {
|
||||
budget.setStatut(dto.getStatut());
|
||||
}
|
||||
if (dto.getResponsable() != null) {
|
||||
budget.setResponsable(dto.getResponsable());
|
||||
}
|
||||
if (dto.getProchainJalon() != null) {
|
||||
budget.setProchainJalon(dto.getProchainJalon());
|
||||
}
|
||||
if (dto.getDateDerniereMiseAJour() != null) {
|
||||
budget.setDateDerniereMiseAJour(dto.getDateDerniereMiseAJour());
|
||||
}
|
||||
if (chantier != null) {
|
||||
budget.setChantier(chantier);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Conversion entité vers ResponseDTO
|
||||
*
|
||||
* @param budget L'entité Budget
|
||||
* @return Le DTO de réponse
|
||||
*/
|
||||
public BudgetResponseDTO toResponseDTO(Budget budget) {
|
||||
if (budget == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
BudgetResponseDTO dto = BudgetResponseDTO.builder()
|
||||
.id(budget.getId())
|
||||
.budgetTotal(budget.getBudgetTotal())
|
||||
.depenseReelle(budget.getDepenseReelle())
|
||||
.ecart(budget.getEcart())
|
||||
.ecartPourcentage(budget.getEcartPourcentage())
|
||||
.avancementTravaux(budget.getAvancementTravaux())
|
||||
.statut(budget.getStatut())
|
||||
.tendance(budget.getTendance())
|
||||
.responsable(budget.getResponsable())
|
||||
.nombreAlertes(budget.getNombreAlertes())
|
||||
.prochainJalon(budget.getProchainJalon())
|
||||
.dateDerniereMiseAJour(budget.getDateDerniereMiseAJour())
|
||||
.actif(budget.getActif())
|
||||
.dateCreation(budget.getDateCreation())
|
||||
.dateModification(budget.getDateModification())
|
||||
.build();
|
||||
|
||||
// Relations simplifiées
|
||||
if (budget.getChantier() != null) {
|
||||
dto.setChantierId(budget.getChantier().getId());
|
||||
dto.setChantierNom(budget.getChantier().getNom());
|
||||
}
|
||||
|
||||
return dto;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,193 +1,193 @@
|
||||
package dev.lions.btpxpress.domain.shared.mapper;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.*;
|
||||
import dev.lions.btpxpress.domain.shared.dto.*;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Mapper pour les devis - Architecture 2025
|
||||
* Suit le même pattern que ChantierMapper et ClientMapper
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@ApplicationScoped
|
||||
public class DevisMapper {
|
||||
|
||||
/**
|
||||
* Conversion DTO vers entité
|
||||
*
|
||||
* @param dto Le DTO de création
|
||||
* @param client Le client associé (chargé depuis le repository)
|
||||
* @param chantier Le chantier associé (optionnel, peut être null)
|
||||
* @return L'entité Devis créée
|
||||
*/
|
||||
public Devis toEntity(DevisCreateDTO dto, Client client, Chantier chantier) {
|
||||
if (dto == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Devis devis = new Devis();
|
||||
devis.setNumero(dto.getNumero());
|
||||
devis.setObjet(dto.getObjet());
|
||||
devis.setDescription(dto.getDescription());
|
||||
devis.setDateEmission(dto.getDateEmission());
|
||||
devis.setDateValidite(dto.getDateValidite());
|
||||
devis.setStatut(dto.getStatut() != null ? dto.getStatut() : StatutDevis.BROUILLON);
|
||||
devis.setMontantHT(dto.getMontantHT());
|
||||
devis.setTauxTVA(dto.getTauxTVA() != null ? dto.getTauxTVA() : BigDecimal.valueOf(20.0));
|
||||
devis.setConditionsPaiement(dto.getConditionsPaiement());
|
||||
devis.setDelaiExecution(dto.getDelaiExecution());
|
||||
devis.setActif(true);
|
||||
devis.setClient(client);
|
||||
devis.setChantier(chantier);
|
||||
|
||||
// Créer les lignes de devis si présentes
|
||||
if (dto.getLignes() != null && !dto.getLignes().isEmpty()) {
|
||||
List<LigneDevis> lignes = new ArrayList<>();
|
||||
int ordre = 1;
|
||||
for (DevisCreateDTO.LigneDevisCreateDTO ligneDTO : dto.getLignes()) {
|
||||
LigneDevis ligne = new LigneDevis();
|
||||
ligne.setDesignation(ligneDTO.getDescription()); // designation = description dans le DTO
|
||||
ligne.setDescription(ligneDTO.getDescription()); // description optionnelle
|
||||
ligne.setQuantite(ligneDTO.getQuantite());
|
||||
ligne.setPrixUnitaire(ligneDTO.getPrixUnitaire());
|
||||
ligne.setUnite(ligneDTO.getUnite() != null ? ligneDTO.getUnite() : "unité");
|
||||
ligne.setOrdre(ordre++);
|
||||
ligne.setDevis(devis);
|
||||
lignes.add(ligne);
|
||||
}
|
||||
devis.setLignes(lignes);
|
||||
}
|
||||
|
||||
return devis;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mise à jour d'entité depuis DTO
|
||||
*
|
||||
* @param devis L'entité à mettre à jour
|
||||
* @param dto Le DTO contenant les nouvelles valeurs
|
||||
* @param client Le client associé (peut être null si non modifié)
|
||||
* @param chantier Le chantier associé (peut être null si non modifié)
|
||||
*/
|
||||
public void updateEntity(Devis devis, DevisCreateDTO dto, Client client, Chantier chantier) {
|
||||
if (devis == null || dto == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
devis.setNumero(dto.getNumero());
|
||||
devis.setObjet(dto.getObjet());
|
||||
devis.setDescription(dto.getDescription());
|
||||
devis.setDateEmission(dto.getDateEmission());
|
||||
devis.setDateValidite(dto.getDateValidite());
|
||||
if (dto.getStatut() != null) {
|
||||
devis.setStatut(dto.getStatut());
|
||||
}
|
||||
devis.setMontantHT(dto.getMontantHT());
|
||||
if (dto.getTauxTVA() != null) {
|
||||
devis.setTauxTVA(dto.getTauxTVA());
|
||||
}
|
||||
devis.setConditionsPaiement(dto.getConditionsPaiement());
|
||||
devis.setDelaiExecution(dto.getDelaiExecution());
|
||||
if (client != null) {
|
||||
devis.setClient(client);
|
||||
}
|
||||
if (chantier != null) {
|
||||
devis.setChantier(chantier);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Conversion entité vers ResponseDTO
|
||||
*
|
||||
* @param devis L'entité Devis
|
||||
* @return Le DTO de réponse
|
||||
*/
|
||||
public DevisResponseDTO toResponseDTO(Devis devis) {
|
||||
if (devis == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
DevisResponseDTO dto = DevisResponseDTO.builder()
|
||||
.id(devis.getId())
|
||||
.numero(devis.getNumero())
|
||||
.objet(devis.getObjet())
|
||||
.description(devis.getDescription())
|
||||
.dateEmission(devis.getDateEmission())
|
||||
.dateValidite(devis.getDateValidite())
|
||||
.statut(devis.getStatut())
|
||||
.montantHT(devis.getMontantHT())
|
||||
.tauxTVA(devis.getTauxTVA())
|
||||
.montantTVA(devis.getMontantTVA())
|
||||
.montantTTC(devis.getMontantTTC())
|
||||
.conditionsPaiement(devis.getConditionsPaiement())
|
||||
.delaiExecution(devis.getDelaiExecution())
|
||||
.actif(devis.getActif())
|
||||
.dateCreation(devis.getDateCreation())
|
||||
.dateModification(devis.getDateModification())
|
||||
.build();
|
||||
|
||||
// Relations simplifiées
|
||||
if (devis.getClient() != null) {
|
||||
dto.setClientId(devis.getClient().getId());
|
||||
dto.setClientNom(devis.getClient().getNomComplet());
|
||||
dto.setClientRaisonSociale(devis.getClient().getEntreprise());
|
||||
}
|
||||
|
||||
if (devis.getChantier() != null) {
|
||||
dto.setChantierId(devis.getChantier().getId());
|
||||
dto.setChantierNom(devis.getChantier().getNom());
|
||||
}
|
||||
|
||||
// Convertir les lignes
|
||||
if (devis.getLignes() != null && !devis.getLignes().isEmpty()) {
|
||||
List<DevisResponseDTO.LigneDevisResponseDTO> lignesDTO = devis.getLignes().stream()
|
||||
.map(this::toLigneResponseDTO)
|
||||
.collect(Collectors.toList());
|
||||
dto.setLignes(lignesDTO);
|
||||
}
|
||||
|
||||
return dto;
|
||||
}
|
||||
|
||||
/**
|
||||
* Conversion d'une ligne de devis vers ResponseDTO
|
||||
*/
|
||||
private DevisResponseDTO.LigneDevisResponseDTO toLigneResponseDTO(LigneDevis ligne) {
|
||||
if (ligne == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Calculer les montants HT, TVA, TTC à partir du montantLigne et du tauxTVA du devis
|
||||
BigDecimal montantHT = ligne.getMontantLigne();
|
||||
BigDecimal tauxTVA = ligne.getDevis() != null && ligne.getDevis().getTauxTVA() != null
|
||||
? ligne.getDevis().getTauxTVA()
|
||||
: BigDecimal.valueOf(20.0);
|
||||
BigDecimal montantTVA = montantHT != null
|
||||
? montantHT.multiply(tauxTVA).divide(BigDecimal.valueOf(100), 2, java.math.RoundingMode.HALF_UP)
|
||||
: null;
|
||||
BigDecimal montantTTC = montantHT != null && montantTVA != null
|
||||
? montantHT.add(montantTVA)
|
||||
: montantHT;
|
||||
|
||||
return DevisResponseDTO.LigneDevisResponseDTO.builder()
|
||||
.id(ligne.getId())
|
||||
.description(ligne.getDesignation() != null ? ligne.getDesignation() : ligne.getDescription())
|
||||
.quantite(ligne.getQuantite())
|
||||
.prixUnitaire(ligne.getPrixUnitaire())
|
||||
.tauxTVA(tauxTVA)
|
||||
.montantHT(montantHT)
|
||||
.montantTVA(montantTVA)
|
||||
.montantTTC(montantTTC)
|
||||
.unite(ligne.getUnite())
|
||||
.ordre(ligne.getOrdre())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.mapper;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.*;
|
||||
import dev.lions.btpxpress.domain.shared.dto.*;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Mapper pour les devis - Architecture 2025
|
||||
* Suit le même pattern que ChantierMapper et ClientMapper
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@ApplicationScoped
|
||||
public class DevisMapper {
|
||||
|
||||
/**
|
||||
* Conversion DTO vers entité
|
||||
*
|
||||
* @param dto Le DTO de création
|
||||
* @param client Le client associé (chargé depuis le repository)
|
||||
* @param chantier Le chantier associé (optionnel, peut être null)
|
||||
* @return L'entité Devis créée
|
||||
*/
|
||||
public Devis toEntity(DevisCreateDTO dto, Client client, Chantier chantier) {
|
||||
if (dto == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Devis devis = new Devis();
|
||||
devis.setNumero(dto.getNumero());
|
||||
devis.setObjet(dto.getObjet());
|
||||
devis.setDescription(dto.getDescription());
|
||||
devis.setDateEmission(dto.getDateEmission());
|
||||
devis.setDateValidite(dto.getDateValidite());
|
||||
devis.setStatut(dto.getStatut() != null ? dto.getStatut() : StatutDevis.BROUILLON);
|
||||
devis.setMontantHT(dto.getMontantHT());
|
||||
devis.setTauxTVA(dto.getTauxTVA() != null ? dto.getTauxTVA() : BigDecimal.valueOf(20.0));
|
||||
devis.setConditionsPaiement(dto.getConditionsPaiement());
|
||||
devis.setDelaiExecution(dto.getDelaiExecution());
|
||||
devis.setActif(true);
|
||||
devis.setClient(client);
|
||||
devis.setChantier(chantier);
|
||||
|
||||
// Créer les lignes de devis si présentes
|
||||
if (dto.getLignes() != null && !dto.getLignes().isEmpty()) {
|
||||
List<LigneDevis> lignes = new ArrayList<>();
|
||||
int ordre = 1;
|
||||
for (DevisCreateDTO.LigneDevisCreateDTO ligneDTO : dto.getLignes()) {
|
||||
LigneDevis ligne = new LigneDevis();
|
||||
ligne.setDesignation(ligneDTO.getDescription()); // designation = description dans le DTO
|
||||
ligne.setDescription(ligneDTO.getDescription()); // description optionnelle
|
||||
ligne.setQuantite(ligneDTO.getQuantite());
|
||||
ligne.setPrixUnitaire(ligneDTO.getPrixUnitaire());
|
||||
ligne.setUnite(ligneDTO.getUnite() != null ? ligneDTO.getUnite() : "unité");
|
||||
ligne.setOrdre(ordre++);
|
||||
ligne.setDevis(devis);
|
||||
lignes.add(ligne);
|
||||
}
|
||||
devis.setLignes(lignes);
|
||||
}
|
||||
|
||||
return devis;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mise à jour d'entité depuis DTO
|
||||
*
|
||||
* @param devis L'entité à mettre à jour
|
||||
* @param dto Le DTO contenant les nouvelles valeurs
|
||||
* @param client Le client associé (peut être null si non modifié)
|
||||
* @param chantier Le chantier associé (peut être null si non modifié)
|
||||
*/
|
||||
public void updateEntity(Devis devis, DevisCreateDTO dto, Client client, Chantier chantier) {
|
||||
if (devis == null || dto == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
devis.setNumero(dto.getNumero());
|
||||
devis.setObjet(dto.getObjet());
|
||||
devis.setDescription(dto.getDescription());
|
||||
devis.setDateEmission(dto.getDateEmission());
|
||||
devis.setDateValidite(dto.getDateValidite());
|
||||
if (dto.getStatut() != null) {
|
||||
devis.setStatut(dto.getStatut());
|
||||
}
|
||||
devis.setMontantHT(dto.getMontantHT());
|
||||
if (dto.getTauxTVA() != null) {
|
||||
devis.setTauxTVA(dto.getTauxTVA());
|
||||
}
|
||||
devis.setConditionsPaiement(dto.getConditionsPaiement());
|
||||
devis.setDelaiExecution(dto.getDelaiExecution());
|
||||
if (client != null) {
|
||||
devis.setClient(client);
|
||||
}
|
||||
if (chantier != null) {
|
||||
devis.setChantier(chantier);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Conversion entité vers ResponseDTO
|
||||
*
|
||||
* @param devis L'entité Devis
|
||||
* @return Le DTO de réponse
|
||||
*/
|
||||
public DevisResponseDTO toResponseDTO(Devis devis) {
|
||||
if (devis == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
DevisResponseDTO dto = DevisResponseDTO.builder()
|
||||
.id(devis.getId())
|
||||
.numero(devis.getNumero())
|
||||
.objet(devis.getObjet())
|
||||
.description(devis.getDescription())
|
||||
.dateEmission(devis.getDateEmission())
|
||||
.dateValidite(devis.getDateValidite())
|
||||
.statut(devis.getStatut())
|
||||
.montantHT(devis.getMontantHT())
|
||||
.tauxTVA(devis.getTauxTVA())
|
||||
.montantTVA(devis.getMontantTVA())
|
||||
.montantTTC(devis.getMontantTTC())
|
||||
.conditionsPaiement(devis.getConditionsPaiement())
|
||||
.delaiExecution(devis.getDelaiExecution())
|
||||
.actif(devis.getActif())
|
||||
.dateCreation(devis.getDateCreation())
|
||||
.dateModification(devis.getDateModification())
|
||||
.build();
|
||||
|
||||
// Relations simplifiées
|
||||
if (devis.getClient() != null) {
|
||||
dto.setClientId(devis.getClient().getId());
|
||||
dto.setClientNom(devis.getClient().getNomComplet());
|
||||
dto.setClientRaisonSociale(devis.getClient().getEntreprise());
|
||||
}
|
||||
|
||||
if (devis.getChantier() != null) {
|
||||
dto.setChantierId(devis.getChantier().getId());
|
||||
dto.setChantierNom(devis.getChantier().getNom());
|
||||
}
|
||||
|
||||
// Convertir les lignes
|
||||
if (devis.getLignes() != null && !devis.getLignes().isEmpty()) {
|
||||
List<DevisResponseDTO.LigneDevisResponseDTO> lignesDTO = devis.getLignes().stream()
|
||||
.map(this::toLigneResponseDTO)
|
||||
.collect(Collectors.toList());
|
||||
dto.setLignes(lignesDTO);
|
||||
}
|
||||
|
||||
return dto;
|
||||
}
|
||||
|
||||
/**
|
||||
* Conversion d'une ligne de devis vers ResponseDTO
|
||||
*/
|
||||
private DevisResponseDTO.LigneDevisResponseDTO toLigneResponseDTO(LigneDevis ligne) {
|
||||
if (ligne == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Calculer les montants HT, TVA, TTC à partir du montantLigne et du tauxTVA du devis
|
||||
BigDecimal montantHT = ligne.getMontantLigne();
|
||||
BigDecimal tauxTVA = ligne.getDevis() != null && ligne.getDevis().getTauxTVA() != null
|
||||
? ligne.getDevis().getTauxTVA()
|
||||
: BigDecimal.valueOf(20.0);
|
||||
BigDecimal montantTVA = montantHT != null
|
||||
? montantHT.multiply(tauxTVA).divide(BigDecimal.valueOf(100), 2, java.math.RoundingMode.HALF_UP)
|
||||
: null;
|
||||
BigDecimal montantTTC = montantHT != null && montantTVA != null
|
||||
? montantHT.add(montantTVA)
|
||||
: montantHT;
|
||||
|
||||
return DevisResponseDTO.LigneDevisResponseDTO.builder()
|
||||
.id(ligne.getId())
|
||||
.description(ligne.getDesignation() != null ? ligne.getDesignation() : ligne.getDescription())
|
||||
.quantite(ligne.getQuantite())
|
||||
.prixUnitaire(ligne.getPrixUnitaire())
|
||||
.tauxTVA(tauxTVA)
|
||||
.montantHT(montantHT)
|
||||
.montantTVA(montantTVA)
|
||||
.montantTTC(montantTTC)
|
||||
.unite(ligne.getUnite())
|
||||
.ordre(ligne.getOrdre())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,70 +1,70 @@
|
||||
package dev.lions.btpxpress.domain.shared.mapper;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.Disponibilite;
|
||||
import dev.lions.btpxpress.domain.shared.dto.DisponibiliteCreateDTO;
|
||||
import dev.lions.btpxpress.domain.shared.dto.DisponibiliteResponseDTO;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
|
||||
/**
|
||||
* Mapper pour les disponibilités - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@ApplicationScoped
|
||||
public class DisponibiliteMapper {
|
||||
|
||||
/**
|
||||
* Conversion DTO vers entité
|
||||
*/
|
||||
public Disponibilite toEntity(DisponibiliteCreateDTO dto) {
|
||||
if (dto == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Disponibilite disponibilite = Disponibilite.builder()
|
||||
.dateDebut(dto.getDateDebut())
|
||||
.dateFin(dto.getDateFin())
|
||||
.type(dto.getType())
|
||||
.motif(dto.getMotif())
|
||||
.approuvee(dto.getApprouvee() != null ? dto.getApprouvee() : false)
|
||||
.build();
|
||||
|
||||
return disponibilite;
|
||||
}
|
||||
|
||||
/**
|
||||
* Conversion entité vers ResponseDTO
|
||||
*/
|
||||
public DisponibiliteResponseDTO toResponseDTO(Disponibilite disponibilite) {
|
||||
if (disponibilite == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
DisponibiliteResponseDTO dto = DisponibiliteResponseDTO.builder()
|
||||
.id(disponibilite.getId())
|
||||
.dateDebut(disponibilite.getDateDebut())
|
||||
.dateFin(disponibilite.getDateFin())
|
||||
.type(disponibilite.getType())
|
||||
.motif(disponibilite.getMotif())
|
||||
.approuvee(disponibilite.getApprouvee())
|
||||
.dateCreation(disponibilite.getDateCreation())
|
||||
.dateModification(disponibilite.getDateModification())
|
||||
.build();
|
||||
|
||||
// Relations simplifiées
|
||||
if (disponibilite.getEmploye() != null) {
|
||||
dto.setEmployeId(disponibilite.getEmploye().getId());
|
||||
dto.setEmployeNom(disponibilite.getEmploye().getNom());
|
||||
dto.setEmployePrenom(disponibilite.getEmploye().getPrenom());
|
||||
}
|
||||
|
||||
// Métadonnées calculées
|
||||
dto.setDureeEnHeures(disponibilite.getDureeEnHeures());
|
||||
dto.setActive(disponibilite.isActive());
|
||||
|
||||
return dto;
|
||||
}
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.mapper;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.Disponibilite;
|
||||
import dev.lions.btpxpress.domain.shared.dto.DisponibiliteCreateDTO;
|
||||
import dev.lions.btpxpress.domain.shared.dto.DisponibiliteResponseDTO;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
|
||||
/**
|
||||
* Mapper pour les disponibilités - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@ApplicationScoped
|
||||
public class DisponibiliteMapper {
|
||||
|
||||
/**
|
||||
* Conversion DTO vers entité
|
||||
*/
|
||||
public Disponibilite toEntity(DisponibiliteCreateDTO dto) {
|
||||
if (dto == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Disponibilite disponibilite = Disponibilite.builder()
|
||||
.dateDebut(dto.getDateDebut())
|
||||
.dateFin(dto.getDateFin())
|
||||
.type(dto.getType())
|
||||
.motif(dto.getMotif())
|
||||
.approuvee(dto.getApprouvee() != null ? dto.getApprouvee() : false)
|
||||
.build();
|
||||
|
||||
return disponibilite;
|
||||
}
|
||||
|
||||
/**
|
||||
* Conversion entité vers ResponseDTO
|
||||
*/
|
||||
public DisponibiliteResponseDTO toResponseDTO(Disponibilite disponibilite) {
|
||||
if (disponibilite == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
DisponibiliteResponseDTO dto = DisponibiliteResponseDTO.builder()
|
||||
.id(disponibilite.getId())
|
||||
.dateDebut(disponibilite.getDateDebut())
|
||||
.dateFin(disponibilite.getDateFin())
|
||||
.type(disponibilite.getType())
|
||||
.motif(disponibilite.getMotif())
|
||||
.approuvee(disponibilite.getApprouvee())
|
||||
.dateCreation(disponibilite.getDateCreation())
|
||||
.dateModification(disponibilite.getDateModification())
|
||||
.build();
|
||||
|
||||
// Relations simplifiées
|
||||
if (disponibilite.getEmploye() != null) {
|
||||
dto.setEmployeId(disponibilite.getEmploye().getId());
|
||||
dto.setEmployeNom(disponibilite.getEmploye().getNom());
|
||||
dto.setEmployePrenom(disponibilite.getEmploye().getPrenom());
|
||||
}
|
||||
|
||||
// Métadonnées calculées
|
||||
dto.setDureeEnHeures(disponibilite.getDureeEnHeures());
|
||||
dto.setActive(disponibilite.isActive());
|
||||
|
||||
return dto;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,107 +1,107 @@
|
||||
package dev.lions.btpxpress.domain.shared.mapper;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.Document;
|
||||
import dev.lions.btpxpress.domain.shared.dto.DocumentCreateDTO;
|
||||
import dev.lions.btpxpress.domain.shared.dto.DocumentResponseDTO;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
|
||||
/**
|
||||
* Mapper pour les documents - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@ApplicationScoped
|
||||
public class DocumentMapper {
|
||||
|
||||
/**
|
||||
* Conversion DTO vers entité
|
||||
*/
|
||||
public Document toEntity(DocumentCreateDTO dto) {
|
||||
if (dto == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Document document = Document.builder()
|
||||
.nom(dto.getNom())
|
||||
.description(dto.getDescription())
|
||||
.nomFichier(dto.getNomFichier())
|
||||
.cheminFichier(dto.getCheminFichier())
|
||||
.typeMime(dto.getTypeMime())
|
||||
.tailleFichier(dto.getTailleFichier())
|
||||
.typeDocument(dto.getTypeDocument())
|
||||
.tags(dto.getTags())
|
||||
.estPublic(dto.getEstPublic() != null ? dto.getEstPublic() : false)
|
||||
.actif(dto.getActif() != null ? dto.getActif() : true)
|
||||
.build();
|
||||
|
||||
return document;
|
||||
}
|
||||
|
||||
/**
|
||||
* Conversion entité vers ResponseDTO
|
||||
*/
|
||||
public DocumentResponseDTO toResponseDTO(Document document) {
|
||||
if (document == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
DocumentResponseDTO dto = DocumentResponseDTO.builder()
|
||||
.id(document.getId())
|
||||
.nom(document.getNom())
|
||||
.description(document.getDescription())
|
||||
.nomFichier(document.getNomFichier())
|
||||
.cheminFichier(document.getCheminFichier())
|
||||
.typeMime(document.getTypeMime())
|
||||
.tailleFichier(document.getTailleFichier())
|
||||
.typeDocument(document.getTypeDocument())
|
||||
.tags(document.getTags())
|
||||
.estPublic(document.getEstPublic())
|
||||
.actif(document.getActif())
|
||||
.dateCreation(document.getDateCreation())
|
||||
.dateModification(document.getDateModification())
|
||||
.build();
|
||||
|
||||
// Relations simplifiées
|
||||
if (document.getChantier() != null) {
|
||||
dto.setChantierId(document.getChantier().getId());
|
||||
dto.setChantierNom(document.getChantier().getNom());
|
||||
}
|
||||
|
||||
if (document.getMateriel() != null) {
|
||||
dto.setMaterielId(document.getMateriel().getId());
|
||||
dto.setMaterielNom(document.getMateriel().getNom());
|
||||
}
|
||||
|
||||
if (document.getEmploye() != null) {
|
||||
dto.setEmployeId(document.getEmploye().getId());
|
||||
dto.setEmployeNom(document.getEmploye().getNom());
|
||||
dto.setEmployePrenom(document.getEmploye().getPrenom());
|
||||
}
|
||||
|
||||
if (document.getEquipe() != null) {
|
||||
dto.setEquipeId(document.getEquipe().getId());
|
||||
dto.setEquipeNom(document.getEquipe().getNom());
|
||||
}
|
||||
|
||||
if (document.getClient() != null) {
|
||||
dto.setClientId(document.getClient().getId());
|
||||
dto.setClientNom(document.getClient().getNom());
|
||||
}
|
||||
|
||||
if (document.getCreePar() != null) {
|
||||
dto.setCreeParId(document.getCreePar().getId());
|
||||
dto.setCreeParNom(document.getCreePar().getEmail());
|
||||
}
|
||||
|
||||
// Métadonnées calculées
|
||||
dto.setExtension(document.getExtension());
|
||||
dto.setTailleFormatee(document.getTailleFormatee());
|
||||
dto.setIsImage(document.isImage());
|
||||
dto.setIsPdf(document.isPdf());
|
||||
|
||||
return dto;
|
||||
}
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.mapper;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.Document;
|
||||
import dev.lions.btpxpress.domain.shared.dto.DocumentCreateDTO;
|
||||
import dev.lions.btpxpress.domain.shared.dto.DocumentResponseDTO;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
|
||||
/**
|
||||
* Mapper pour les documents - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@ApplicationScoped
|
||||
public class DocumentMapper {
|
||||
|
||||
/**
|
||||
* Conversion DTO vers entité
|
||||
*/
|
||||
public Document toEntity(DocumentCreateDTO dto) {
|
||||
if (dto == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Document document = Document.builder()
|
||||
.nom(dto.getNom())
|
||||
.description(dto.getDescription())
|
||||
.nomFichier(dto.getNomFichier())
|
||||
.cheminFichier(dto.getCheminFichier())
|
||||
.typeMime(dto.getTypeMime())
|
||||
.tailleFichier(dto.getTailleFichier())
|
||||
.typeDocument(dto.getTypeDocument())
|
||||
.tags(dto.getTags())
|
||||
.estPublic(dto.getEstPublic() != null ? dto.getEstPublic() : false)
|
||||
.actif(dto.getActif() != null ? dto.getActif() : true)
|
||||
.build();
|
||||
|
||||
return document;
|
||||
}
|
||||
|
||||
/**
|
||||
* Conversion entité vers ResponseDTO
|
||||
*/
|
||||
public DocumentResponseDTO toResponseDTO(Document document) {
|
||||
if (document == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
DocumentResponseDTO dto = DocumentResponseDTO.builder()
|
||||
.id(document.getId())
|
||||
.nom(document.getNom())
|
||||
.description(document.getDescription())
|
||||
.nomFichier(document.getNomFichier())
|
||||
.cheminFichier(document.getCheminFichier())
|
||||
.typeMime(document.getTypeMime())
|
||||
.tailleFichier(document.getTailleFichier())
|
||||
.typeDocument(document.getTypeDocument())
|
||||
.tags(document.getTags())
|
||||
.estPublic(document.getEstPublic())
|
||||
.actif(document.getActif())
|
||||
.dateCreation(document.getDateCreation())
|
||||
.dateModification(document.getDateModification())
|
||||
.build();
|
||||
|
||||
// Relations simplifiées
|
||||
if (document.getChantier() != null) {
|
||||
dto.setChantierId(document.getChantier().getId());
|
||||
dto.setChantierNom(document.getChantier().getNom());
|
||||
}
|
||||
|
||||
if (document.getMateriel() != null) {
|
||||
dto.setMaterielId(document.getMateriel().getId());
|
||||
dto.setMaterielNom(document.getMateriel().getNom());
|
||||
}
|
||||
|
||||
if (document.getEmploye() != null) {
|
||||
dto.setEmployeId(document.getEmploye().getId());
|
||||
dto.setEmployeNom(document.getEmploye().getNom());
|
||||
dto.setEmployePrenom(document.getEmploye().getPrenom());
|
||||
}
|
||||
|
||||
if (document.getEquipe() != null) {
|
||||
dto.setEquipeId(document.getEquipe().getId());
|
||||
dto.setEquipeNom(document.getEquipe().getNom());
|
||||
}
|
||||
|
||||
if (document.getClient() != null) {
|
||||
dto.setClientId(document.getClient().getId());
|
||||
dto.setClientNom(document.getClient().getNom());
|
||||
}
|
||||
|
||||
if (document.getCreePar() != null) {
|
||||
dto.setCreeParId(document.getCreePar().getId());
|
||||
dto.setCreeParNom(document.getCreePar().getEmail());
|
||||
}
|
||||
|
||||
// Métadonnées calculées
|
||||
dto.setExtension(document.getExtension());
|
||||
dto.setTailleFormatee(document.getTailleFormatee());
|
||||
dto.setIsImage(document.isImage());
|
||||
dto.setIsPdf(document.isPdf());
|
||||
|
||||
return dto;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,127 +1,127 @@
|
||||
package dev.lions.btpxpress.domain.shared.mapper;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.*;
|
||||
import dev.lions.btpxpress.domain.shared.dto.*;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
|
||||
/**
|
||||
* Mapper pour les employés - Architecture 2025
|
||||
* Suit le même pattern que ChantierMapper et ClientMapper
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@ApplicationScoped
|
||||
public class EmployeMapper {
|
||||
|
||||
/**
|
||||
* Conversion DTO vers entité
|
||||
*
|
||||
* @param dto Le DTO de création
|
||||
* @param equipe L'équipe associée (optionnel, peut être null)
|
||||
* @return L'entité Employe créée
|
||||
*/
|
||||
public Employe toEntity(EmployeCreateDTO dto, Equipe equipe) {
|
||||
if (dto == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Employe employe = new Employe();
|
||||
employe.setNom(dto.getNom());
|
||||
employe.setPrenom(dto.getPrenom());
|
||||
employe.setEmail(dto.getEmail());
|
||||
employe.setTelephone(dto.getTelephone());
|
||||
employe.setPoste(dto.getPoste());
|
||||
employe.setFonction(dto.getFonction());
|
||||
employe.setSpecialites(dto.getSpecialites());
|
||||
employe.setTauxHoraire(dto.getTauxHoraire());
|
||||
employe.setDateEmbauche(dto.getDateEmbauche());
|
||||
employe.setStatut(dto.getStatut() != null ? dto.getStatut() : StatutEmploye.ACTIF);
|
||||
employe.setActif(true);
|
||||
employe.setEquipe(equipe);
|
||||
|
||||
return employe;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mise à jour d'entité depuis DTO
|
||||
*
|
||||
* @param employe L'entité à mettre à jour
|
||||
* @param dto Le DTO contenant les nouvelles valeurs
|
||||
* @param equipe L'équipe associée (peut être null si non modifiée)
|
||||
*/
|
||||
public void updateEntity(Employe employe, EmployeCreateDTO dto, Equipe equipe) {
|
||||
if (employe == null || dto == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
employe.setNom(dto.getNom());
|
||||
employe.setPrenom(dto.getPrenom());
|
||||
employe.setEmail(dto.getEmail());
|
||||
employe.setTelephone(dto.getTelephone());
|
||||
employe.setPoste(dto.getPoste());
|
||||
employe.setFonction(dto.getFonction());
|
||||
employe.setSpecialites(dto.getSpecialites());
|
||||
employe.setTauxHoraire(dto.getTauxHoraire());
|
||||
employe.setDateEmbauche(dto.getDateEmbauche());
|
||||
if (dto.getStatut() != null) {
|
||||
employe.setStatut(dto.getStatut());
|
||||
}
|
||||
if (equipe != null) {
|
||||
employe.setEquipe(equipe);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Conversion entité vers ResponseDTO
|
||||
*
|
||||
* @param employe L'entité Employe
|
||||
* @return Le DTO de réponse
|
||||
*/
|
||||
public EmployeResponseDTO toResponseDTO(Employe employe) {
|
||||
if (employe == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
EmployeResponseDTO dto = EmployeResponseDTO.builder()
|
||||
.id(employe.getId())
|
||||
.nom(employe.getNom())
|
||||
.prenom(employe.getPrenom())
|
||||
.nomComplet(employe.getNomComplet())
|
||||
.email(employe.getEmail())
|
||||
.telephone(employe.getTelephone())
|
||||
.poste(employe.getPoste())
|
||||
.fonction(employe.getFonction())
|
||||
.specialites(employe.getSpecialites())
|
||||
.tauxHoraire(employe.getTauxHoraire())
|
||||
.dateEmbauche(employe.getDateEmbauche())
|
||||
.statut(employe.getStatut())
|
||||
.actif(employe.getActif())
|
||||
.dateCreation(employe.getDateCreation())
|
||||
.dateModification(employe.getDateModification())
|
||||
.build();
|
||||
|
||||
// Relations simplifiées
|
||||
if (employe.getEquipe() != null) {
|
||||
dto.setEquipeId(employe.getEquipe().getId());
|
||||
dto.setEquipeNom(employe.getEquipe().getNom());
|
||||
}
|
||||
|
||||
// Compter les disponibilités et compétences
|
||||
if (employe.getDisponibilites() != null) {
|
||||
dto.setNombreDisponibilites(employe.getDisponibilites().size());
|
||||
} else {
|
||||
dto.setNombreDisponibilites(0);
|
||||
}
|
||||
|
||||
if (employe.getCompetences() != null) {
|
||||
dto.setNombreCompetences(employe.getCompetences().size());
|
||||
} else {
|
||||
dto.setNombreCompetences(0);
|
||||
}
|
||||
|
||||
return dto;
|
||||
}
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.mapper;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.*;
|
||||
import dev.lions.btpxpress.domain.shared.dto.*;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
|
||||
/**
|
||||
* Mapper pour les employés - Architecture 2025
|
||||
* Suit le même pattern que ChantierMapper et ClientMapper
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@ApplicationScoped
|
||||
public class EmployeMapper {
|
||||
|
||||
/**
|
||||
* Conversion DTO vers entité
|
||||
*
|
||||
* @param dto Le DTO de création
|
||||
* @param equipe L'équipe associée (optionnel, peut être null)
|
||||
* @return L'entité Employe créée
|
||||
*/
|
||||
public Employe toEntity(EmployeCreateDTO dto, Equipe equipe) {
|
||||
if (dto == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Employe employe = new Employe();
|
||||
employe.setNom(dto.getNom());
|
||||
employe.setPrenom(dto.getPrenom());
|
||||
employe.setEmail(dto.getEmail());
|
||||
employe.setTelephone(dto.getTelephone());
|
||||
employe.setPoste(dto.getPoste());
|
||||
employe.setFonction(dto.getFonction());
|
||||
employe.setSpecialites(dto.getSpecialites());
|
||||
employe.setTauxHoraire(dto.getTauxHoraire());
|
||||
employe.setDateEmbauche(dto.getDateEmbauche());
|
||||
employe.setStatut(dto.getStatut() != null ? dto.getStatut() : StatutEmploye.ACTIF);
|
||||
employe.setActif(true);
|
||||
employe.setEquipe(equipe);
|
||||
|
||||
return employe;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mise à jour d'entité depuis DTO
|
||||
*
|
||||
* @param employe L'entité à mettre à jour
|
||||
* @param dto Le DTO contenant les nouvelles valeurs
|
||||
* @param equipe L'équipe associée (peut être null si non modifiée)
|
||||
*/
|
||||
public void updateEntity(Employe employe, EmployeCreateDTO dto, Equipe equipe) {
|
||||
if (employe == null || dto == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
employe.setNom(dto.getNom());
|
||||
employe.setPrenom(dto.getPrenom());
|
||||
employe.setEmail(dto.getEmail());
|
||||
employe.setTelephone(dto.getTelephone());
|
||||
employe.setPoste(dto.getPoste());
|
||||
employe.setFonction(dto.getFonction());
|
||||
employe.setSpecialites(dto.getSpecialites());
|
||||
employe.setTauxHoraire(dto.getTauxHoraire());
|
||||
employe.setDateEmbauche(dto.getDateEmbauche());
|
||||
if (dto.getStatut() != null) {
|
||||
employe.setStatut(dto.getStatut());
|
||||
}
|
||||
if (equipe != null) {
|
||||
employe.setEquipe(equipe);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Conversion entité vers ResponseDTO
|
||||
*
|
||||
* @param employe L'entité Employe
|
||||
* @return Le DTO de réponse
|
||||
*/
|
||||
public EmployeResponseDTO toResponseDTO(Employe employe) {
|
||||
if (employe == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
EmployeResponseDTO dto = EmployeResponseDTO.builder()
|
||||
.id(employe.getId())
|
||||
.nom(employe.getNom())
|
||||
.prenom(employe.getPrenom())
|
||||
.nomComplet(employe.getNomComplet())
|
||||
.email(employe.getEmail())
|
||||
.telephone(employe.getTelephone())
|
||||
.poste(employe.getPoste())
|
||||
.fonction(employe.getFonction())
|
||||
.specialites(employe.getSpecialites())
|
||||
.tauxHoraire(employe.getTauxHoraire())
|
||||
.dateEmbauche(employe.getDateEmbauche())
|
||||
.statut(employe.getStatut())
|
||||
.actif(employe.getActif())
|
||||
.dateCreation(employe.getDateCreation())
|
||||
.dateModification(employe.getDateModification())
|
||||
.build();
|
||||
|
||||
// Relations simplifiées
|
||||
if (employe.getEquipe() != null) {
|
||||
dto.setEquipeId(employe.getEquipe().getId());
|
||||
dto.setEquipeNom(employe.getEquipe().getNom());
|
||||
}
|
||||
|
||||
// Compter les disponibilités et compétences
|
||||
if (employe.getDisponibilites() != null) {
|
||||
dto.setNombreDisponibilites(employe.getDisponibilites().size());
|
||||
} else {
|
||||
dto.setNombreDisponibilites(0);
|
||||
}
|
||||
|
||||
if (employe.getCompetences() != null) {
|
||||
dto.setNombreCompetences(employe.getCompetences().size());
|
||||
} else {
|
||||
dto.setNombreCompetences(0);
|
||||
}
|
||||
|
||||
return dto;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,134 +1,134 @@
|
||||
package dev.lions.btpxpress.domain.shared.mapper;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.EntrepriseProfile;
|
||||
import dev.lions.btpxpress.domain.core.entity.User;
|
||||
import dev.lions.btpxpress.domain.shared.dto.EntrepriseProfileCreateDTO;
|
||||
import dev.lions.btpxpress.domain.shared.dto.EntrepriseProfileResponseDTO;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
|
||||
/**
|
||||
* Mapper pour les profils d'entreprise - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@ApplicationScoped
|
||||
public class EntrepriseProfileMapper {
|
||||
|
||||
/**
|
||||
* Conversion DTO vers entité
|
||||
*/
|
||||
public EntrepriseProfile toEntity(EntrepriseProfileCreateDTO dto) {
|
||||
if (dto == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
EntrepriseProfile profile = new EntrepriseProfile();
|
||||
|
||||
// Créer un User avec juste l'ID (le service chargera l'entité complète)
|
||||
if (dto.getProprietaireId() != null) {
|
||||
User proprietaire = new User();
|
||||
proprietaire.setId(dto.getProprietaireId());
|
||||
profile.setProprietaire(proprietaire);
|
||||
}
|
||||
|
||||
profile.setNomCommercial(dto.getNomCommercial());
|
||||
profile.setDescription(dto.getDescription());
|
||||
profile.setSlogan(dto.getSlogan());
|
||||
profile.setSpecialites(dto.getSpecialites());
|
||||
profile.setCertifications(dto.getCertifications());
|
||||
profile.setAdresseComplete(dto.getAdresseComplete());
|
||||
profile.setCodePostal(dto.getCodePostal());
|
||||
profile.setVille(dto.getVille());
|
||||
profile.setDepartement(dto.getDepartement());
|
||||
profile.setRegion(dto.getRegion());
|
||||
profile.setZonesIntervention(dto.getZonesIntervention());
|
||||
profile.setSiteWeb(dto.getSiteWeb());
|
||||
profile.setEmailContact(dto.getEmailContact());
|
||||
profile.setTelephoneCommercial(dto.getTelephoneCommercial());
|
||||
profile.setLogoUrl(dto.getLogoUrl());
|
||||
profile.setPhotosRealisations(dto.getPhotosRealisations());
|
||||
profile.setNoteGlobale(dto.getNoteGlobale() != null ? dto.getNoteGlobale() : java.math.BigDecimal.ZERO);
|
||||
profile.setNombreAvis(dto.getNombreAvis() != null ? dto.getNombreAvis() : 0);
|
||||
profile.setNombreProjetsRealises(dto.getNombreProjetsRealises() != null ? dto.getNombreProjetsRealises() : 0);
|
||||
profile.setNombreClientsServis(dto.getNombreClientsServis() != null ? dto.getNombreClientsServis() : 0);
|
||||
profile.setVisible(dto.getVisible() != null ? dto.getVisible() : true);
|
||||
profile.setCertifie(dto.getCertifie() != null ? dto.getCertifie() : false);
|
||||
profile.setTypeAbonnement(dto.getTypeAbonnement() != null ? dto.getTypeAbonnement() : dev.lions.btpxpress.domain.core.entity.TypeAbonnement.GRATUIT);
|
||||
profile.setFinAbonnement(dto.getFinAbonnement());
|
||||
profile.setBudgetMinProjet(dto.getBudgetMinProjet());
|
||||
profile.setBudgetMaxProjet(dto.getBudgetMaxProjet());
|
||||
profile.setAccepteUrgences(dto.getAccepteUrgences() != null ? dto.getAccepteUrgences() : true);
|
||||
profile.setAccepteWeekends(dto.getAccepteWeekends() != null ? dto.getAccepteWeekends() : false);
|
||||
profile.setDelaiMoyenIntervention(dto.getDelaiMoyenIntervention());
|
||||
profile.setChiffresAffairesAnnuel(dto.getChiffresAffairesAnnuel());
|
||||
profile.setGarantiesProposees(dto.getGarantiesProposees());
|
||||
|
||||
return profile;
|
||||
}
|
||||
|
||||
/**
|
||||
* Conversion entité vers ResponseDTO
|
||||
*/
|
||||
public EntrepriseProfileResponseDTO toResponseDTO(EntrepriseProfile profile) {
|
||||
if (profile == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
EntrepriseProfileResponseDTO dto = EntrepriseProfileResponseDTO.builder()
|
||||
.id(profile.getId())
|
||||
.nomCommercial(profile.getNomCommercial())
|
||||
.description(profile.getDescription())
|
||||
.slogan(profile.getSlogan())
|
||||
.specialites(profile.getSpecialites())
|
||||
.certifications(profile.getCertifications())
|
||||
.adresseComplete(profile.getAdresseComplete())
|
||||
.codePostal(profile.getCodePostal())
|
||||
.ville(profile.getVille())
|
||||
.departement(profile.getDepartement())
|
||||
.region(profile.getRegion())
|
||||
.zonesIntervention(profile.getZonesIntervention())
|
||||
.siteWeb(profile.getSiteWeb())
|
||||
.emailContact(profile.getEmailContact())
|
||||
.telephoneCommercial(profile.getTelephoneCommercial())
|
||||
.logoUrl(profile.getLogoUrl())
|
||||
.photosRealisations(profile.getPhotosRealisations())
|
||||
.noteGlobale(profile.getNoteGlobale())
|
||||
.nombreAvis(profile.getNombreAvis())
|
||||
.nombreProjetsRealises(profile.getNombreProjetsRealises())
|
||||
.nombreClientsServis(profile.getNombreClientsServis())
|
||||
.visible(profile.getVisible())
|
||||
.certifie(profile.getCertifie())
|
||||
.typeAbonnement(profile.getTypeAbonnement())
|
||||
.finAbonnement(profile.getFinAbonnement())
|
||||
.budgetMinProjet(profile.getBudgetMinProjet())
|
||||
.budgetMaxProjet(profile.getBudgetMaxProjet())
|
||||
.accepteUrgences(profile.getAccepteUrgences())
|
||||
.accepteWeekends(profile.getAccepteWeekends())
|
||||
.delaiMoyenIntervention(profile.getDelaiMoyenIntervention())
|
||||
.chiffresAffairesAnnuel(profile.getChiffresAffairesAnnuel())
|
||||
.garantiesProposees(profile.getGarantiesProposees())
|
||||
.dateCreation(profile.getDateCreation())
|
||||
.dateModification(profile.getDateModification())
|
||||
.derniereMiseAJour(profile.getDerniereMiseAJour())
|
||||
.derniereActivite(profile.getDerniereActivite())
|
||||
.build();
|
||||
|
||||
// Relations simplifiées
|
||||
if (profile.getProprietaire() != null) {
|
||||
dto.setProprietaireId(profile.getProprietaire().getId());
|
||||
dto.setProprietaireNom(profile.getProprietaire().getNom() + " " + profile.getProprietaire().getPrenom());
|
||||
dto.setProprietaireEmail(profile.getProprietaire().getEmail());
|
||||
}
|
||||
|
||||
// Métadonnées calculées
|
||||
dto.setIsAbonnementActif(profile.isAbonnementActif());
|
||||
dto.setIsPremium(profile.isPremium());
|
||||
dto.setIsEnterprise(profile.isEnterprise());
|
||||
dto.setScoreVisibilite(profile.getScoreVisibilite());
|
||||
|
||||
return dto;
|
||||
}
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.mapper;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.EntrepriseProfile;
|
||||
import dev.lions.btpxpress.domain.core.entity.User;
|
||||
import dev.lions.btpxpress.domain.shared.dto.EntrepriseProfileCreateDTO;
|
||||
import dev.lions.btpxpress.domain.shared.dto.EntrepriseProfileResponseDTO;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
|
||||
/**
|
||||
* Mapper pour les profils d'entreprise - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@ApplicationScoped
|
||||
public class EntrepriseProfileMapper {
|
||||
|
||||
/**
|
||||
* Conversion DTO vers entité
|
||||
*/
|
||||
public EntrepriseProfile toEntity(EntrepriseProfileCreateDTO dto) {
|
||||
if (dto == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
EntrepriseProfile profile = new EntrepriseProfile();
|
||||
|
||||
// Créer un User avec juste l'ID (le service chargera l'entité complète)
|
||||
if (dto.getProprietaireId() != null) {
|
||||
User proprietaire = new User();
|
||||
proprietaire.setId(dto.getProprietaireId());
|
||||
profile.setProprietaire(proprietaire);
|
||||
}
|
||||
|
||||
profile.setNomCommercial(dto.getNomCommercial());
|
||||
profile.setDescription(dto.getDescription());
|
||||
profile.setSlogan(dto.getSlogan());
|
||||
profile.setSpecialites(dto.getSpecialites());
|
||||
profile.setCertifications(dto.getCertifications());
|
||||
profile.setAdresseComplete(dto.getAdresseComplete());
|
||||
profile.setCodePostal(dto.getCodePostal());
|
||||
profile.setVille(dto.getVille());
|
||||
profile.setDepartement(dto.getDepartement());
|
||||
profile.setRegion(dto.getRegion());
|
||||
profile.setZonesIntervention(dto.getZonesIntervention());
|
||||
profile.setSiteWeb(dto.getSiteWeb());
|
||||
profile.setEmailContact(dto.getEmailContact());
|
||||
profile.setTelephoneCommercial(dto.getTelephoneCommercial());
|
||||
profile.setLogoUrl(dto.getLogoUrl());
|
||||
profile.setPhotosRealisations(dto.getPhotosRealisations());
|
||||
profile.setNoteGlobale(dto.getNoteGlobale() != null ? dto.getNoteGlobale() : java.math.BigDecimal.ZERO);
|
||||
profile.setNombreAvis(dto.getNombreAvis() != null ? dto.getNombreAvis() : 0);
|
||||
profile.setNombreProjetsRealises(dto.getNombreProjetsRealises() != null ? dto.getNombreProjetsRealises() : 0);
|
||||
profile.setNombreClientsServis(dto.getNombreClientsServis() != null ? dto.getNombreClientsServis() : 0);
|
||||
profile.setVisible(dto.getVisible() != null ? dto.getVisible() : true);
|
||||
profile.setCertifie(dto.getCertifie() != null ? dto.getCertifie() : false);
|
||||
profile.setTypeAbonnement(dto.getTypeAbonnement() != null ? dto.getTypeAbonnement() : dev.lions.btpxpress.domain.core.entity.TypeAbonnement.GRATUIT);
|
||||
profile.setFinAbonnement(dto.getFinAbonnement());
|
||||
profile.setBudgetMinProjet(dto.getBudgetMinProjet());
|
||||
profile.setBudgetMaxProjet(dto.getBudgetMaxProjet());
|
||||
profile.setAccepteUrgences(dto.getAccepteUrgences() != null ? dto.getAccepteUrgences() : true);
|
||||
profile.setAccepteWeekends(dto.getAccepteWeekends() != null ? dto.getAccepteWeekends() : false);
|
||||
profile.setDelaiMoyenIntervention(dto.getDelaiMoyenIntervention());
|
||||
profile.setChiffresAffairesAnnuel(dto.getChiffresAffairesAnnuel());
|
||||
profile.setGarantiesProposees(dto.getGarantiesProposees());
|
||||
|
||||
return profile;
|
||||
}
|
||||
|
||||
/**
|
||||
* Conversion entité vers ResponseDTO
|
||||
*/
|
||||
public EntrepriseProfileResponseDTO toResponseDTO(EntrepriseProfile profile) {
|
||||
if (profile == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
EntrepriseProfileResponseDTO dto = EntrepriseProfileResponseDTO.builder()
|
||||
.id(profile.getId())
|
||||
.nomCommercial(profile.getNomCommercial())
|
||||
.description(profile.getDescription())
|
||||
.slogan(profile.getSlogan())
|
||||
.specialites(profile.getSpecialites())
|
||||
.certifications(profile.getCertifications())
|
||||
.adresseComplete(profile.getAdresseComplete())
|
||||
.codePostal(profile.getCodePostal())
|
||||
.ville(profile.getVille())
|
||||
.departement(profile.getDepartement())
|
||||
.region(profile.getRegion())
|
||||
.zonesIntervention(profile.getZonesIntervention())
|
||||
.siteWeb(profile.getSiteWeb())
|
||||
.emailContact(profile.getEmailContact())
|
||||
.telephoneCommercial(profile.getTelephoneCommercial())
|
||||
.logoUrl(profile.getLogoUrl())
|
||||
.photosRealisations(profile.getPhotosRealisations())
|
||||
.noteGlobale(profile.getNoteGlobale())
|
||||
.nombreAvis(profile.getNombreAvis())
|
||||
.nombreProjetsRealises(profile.getNombreProjetsRealises())
|
||||
.nombreClientsServis(profile.getNombreClientsServis())
|
||||
.visible(profile.getVisible())
|
||||
.certifie(profile.getCertifie())
|
||||
.typeAbonnement(profile.getTypeAbonnement())
|
||||
.finAbonnement(profile.getFinAbonnement())
|
||||
.budgetMinProjet(profile.getBudgetMinProjet())
|
||||
.budgetMaxProjet(profile.getBudgetMaxProjet())
|
||||
.accepteUrgences(profile.getAccepteUrgences())
|
||||
.accepteWeekends(profile.getAccepteWeekends())
|
||||
.delaiMoyenIntervention(profile.getDelaiMoyenIntervention())
|
||||
.chiffresAffairesAnnuel(profile.getChiffresAffairesAnnuel())
|
||||
.garantiesProposees(profile.getGarantiesProposees())
|
||||
.dateCreation(profile.getDateCreation())
|
||||
.dateModification(profile.getDateModification())
|
||||
.derniereMiseAJour(profile.getDerniereMiseAJour())
|
||||
.derniereActivite(profile.getDerniereActivite())
|
||||
.build();
|
||||
|
||||
// Relations simplifiées
|
||||
if (profile.getProprietaire() != null) {
|
||||
dto.setProprietaireId(profile.getProprietaire().getId());
|
||||
dto.setProprietaireNom(profile.getProprietaire().getNom() + " " + profile.getProprietaire().getPrenom());
|
||||
dto.setProprietaireEmail(profile.getProprietaire().getEmail());
|
||||
}
|
||||
|
||||
// Métadonnées calculées
|
||||
dto.setIsAbonnementActif(profile.isAbonnementActif());
|
||||
dto.setIsPremium(profile.isPremium());
|
||||
dto.setIsEnterprise(profile.isEnterprise());
|
||||
dto.setScoreVisibilite(profile.getScoreVisibilite());
|
||||
|
||||
return dto;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,98 +1,98 @@
|
||||
package dev.lions.btpxpress.domain.shared.mapper;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.Equipe;
|
||||
import dev.lions.btpxpress.domain.shared.dto.EquipeCreateDTO;
|
||||
import dev.lions.btpxpress.domain.shared.dto.EquipeResponseDTO;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
import java.util.ArrayList;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Mapper pour les équipes - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@ApplicationScoped
|
||||
public class EquipeMapper {
|
||||
|
||||
/**
|
||||
* Conversion DTO vers entité
|
||||
*/
|
||||
public Equipe toEntity(EquipeCreateDTO dto) {
|
||||
if (dto == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Equipe equipe = Equipe.builder()
|
||||
.nom(dto.getNom())
|
||||
.description(dto.getDescription())
|
||||
.specialite(dto.getSpecialite())
|
||||
.statut(dto.getStatut() != null ? dto.getStatut() : dev.lions.btpxpress.domain.core.entity.StatutEquipe.ACTIVE)
|
||||
.actif(dto.getActif() != null ? dto.getActif() : true)
|
||||
.build();
|
||||
|
||||
// Gérer les spécialités
|
||||
if (dto.getSpecialites() != null && !dto.getSpecialites().isEmpty()) {
|
||||
equipe.setSpecialites(dto.getSpecialites());
|
||||
}
|
||||
|
||||
return equipe;
|
||||
}
|
||||
|
||||
/**
|
||||
* Conversion entité vers ResponseDTO
|
||||
*/
|
||||
public EquipeResponseDTO toResponseDTO(Equipe equipe) {
|
||||
if (equipe == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
EquipeResponseDTO dto = EquipeResponseDTO.builder()
|
||||
.id(equipe.getId())
|
||||
.nom(equipe.getNom())
|
||||
.description(equipe.getDescription())
|
||||
.statut(equipe.getStatut())
|
||||
.specialite(equipe.getSpecialite())
|
||||
.actif(equipe.getActif())
|
||||
.dateCreation(equipe.getDateCreation())
|
||||
.dateModification(equipe.getDateModification())
|
||||
.build();
|
||||
|
||||
// Gérer les spécialités
|
||||
dto.setSpecialites(equipe.getSpecialites());
|
||||
|
||||
// Relations simplifiées
|
||||
if (equipe.getChef() != null) {
|
||||
dto.setChefId(equipe.getChef().getId());
|
||||
dto.setChefNom(equipe.getChef().getNom());
|
||||
dto.setChefPrenom(equipe.getChef().getPrenom());
|
||||
}
|
||||
|
||||
// Membres
|
||||
if (equipe.getMembres() != null) {
|
||||
dto.setMembreIds(equipe.getMembres().stream()
|
||||
.map(emp -> emp.getId())
|
||||
.collect(Collectors.toList()));
|
||||
dto.setNombreMembres(equipe.getNombreMembres());
|
||||
} else {
|
||||
dto.setMembreIds(new ArrayList<>());
|
||||
dto.setNombreMembres(0);
|
||||
}
|
||||
|
||||
// Chantiers
|
||||
if (equipe.getChantiers() != null) {
|
||||
dto.setChantierIds(equipe.getChantiers().stream()
|
||||
.map(chantier -> chantier.getId())
|
||||
.collect(Collectors.toList()));
|
||||
dto.setNombreChantiers(equipe.getChantiers().size());
|
||||
} else {
|
||||
dto.setChantierIds(new ArrayList<>());
|
||||
dto.setNombreChantiers(0);
|
||||
}
|
||||
|
||||
return dto;
|
||||
}
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.mapper;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.Equipe;
|
||||
import dev.lions.btpxpress.domain.shared.dto.EquipeCreateDTO;
|
||||
import dev.lions.btpxpress.domain.shared.dto.EquipeResponseDTO;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
import java.util.ArrayList;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Mapper pour les équipes - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@ApplicationScoped
|
||||
public class EquipeMapper {
|
||||
|
||||
/**
|
||||
* Conversion DTO vers entité
|
||||
*/
|
||||
public Equipe toEntity(EquipeCreateDTO dto) {
|
||||
if (dto == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Equipe equipe = Equipe.builder()
|
||||
.nom(dto.getNom())
|
||||
.description(dto.getDescription())
|
||||
.specialite(dto.getSpecialite())
|
||||
.statut(dto.getStatut() != null ? dto.getStatut() : dev.lions.btpxpress.domain.core.entity.StatutEquipe.ACTIVE)
|
||||
.actif(dto.getActif() != null ? dto.getActif() : true)
|
||||
.build();
|
||||
|
||||
// Gérer les spécialités
|
||||
if (dto.getSpecialites() != null && !dto.getSpecialites().isEmpty()) {
|
||||
equipe.setSpecialites(dto.getSpecialites());
|
||||
}
|
||||
|
||||
return equipe;
|
||||
}
|
||||
|
||||
/**
|
||||
* Conversion entité vers ResponseDTO
|
||||
*/
|
||||
public EquipeResponseDTO toResponseDTO(Equipe equipe) {
|
||||
if (equipe == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
EquipeResponseDTO dto = EquipeResponseDTO.builder()
|
||||
.id(equipe.getId())
|
||||
.nom(equipe.getNom())
|
||||
.description(equipe.getDescription())
|
||||
.statut(equipe.getStatut())
|
||||
.specialite(equipe.getSpecialite())
|
||||
.actif(equipe.getActif())
|
||||
.dateCreation(equipe.getDateCreation())
|
||||
.dateModification(equipe.getDateModification())
|
||||
.build();
|
||||
|
||||
// Gérer les spécialités
|
||||
dto.setSpecialites(equipe.getSpecialites());
|
||||
|
||||
// Relations simplifiées
|
||||
if (equipe.getChef() != null) {
|
||||
dto.setChefId(equipe.getChef().getId());
|
||||
dto.setChefNom(equipe.getChef().getNom());
|
||||
dto.setChefPrenom(equipe.getChef().getPrenom());
|
||||
}
|
||||
|
||||
// Membres
|
||||
if (equipe.getMembres() != null) {
|
||||
dto.setMembreIds(equipe.getMembres().stream()
|
||||
.map(emp -> emp.getId())
|
||||
.collect(Collectors.toList()));
|
||||
dto.setNombreMembres(equipe.getNombreMembres());
|
||||
} else {
|
||||
dto.setMembreIds(new ArrayList<>());
|
||||
dto.setNombreMembres(0);
|
||||
}
|
||||
|
||||
// Chantiers
|
||||
if (equipe.getChantiers() != null) {
|
||||
dto.setChantierIds(equipe.getChantiers().stream()
|
||||
.map(chantier -> chantier.getId())
|
||||
.collect(Collectors.toList()));
|
||||
dto.setNombreChantiers(equipe.getChantiers().size());
|
||||
} else {
|
||||
dto.setChantierIds(new ArrayList<>());
|
||||
dto.setNombreChantiers(0);
|
||||
}
|
||||
|
||||
return dto;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,213 +1,213 @@
|
||||
package dev.lions.btpxpress.domain.shared.mapper;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.*;
|
||||
import dev.lions.btpxpress.domain.shared.dto.*;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Mapper pour les factures - Architecture 2025
|
||||
* Suit le même pattern que ChantierMapper et ClientMapper
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@ApplicationScoped
|
||||
public class FactureMapper {
|
||||
|
||||
/**
|
||||
* Conversion DTO vers entité
|
||||
*
|
||||
* @param dto Le DTO de création
|
||||
* @param client Le client associé (chargé depuis le repository)
|
||||
* @param chantier Le chantier associé (optionnel, peut être null)
|
||||
* @param devis Le devis associé (optionnel, peut être null)
|
||||
* @return L'entité Facture créée
|
||||
*/
|
||||
public Facture toEntity(FactureCreateDTO dto, Client client, Chantier chantier, Devis devis) {
|
||||
if (dto == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Facture facture = new Facture();
|
||||
facture.setNumero(dto.getNumero());
|
||||
facture.setObjet(dto.getObjet());
|
||||
facture.setDescription(dto.getDescription());
|
||||
facture.setDateEmission(dto.getDateEmission());
|
||||
facture.setDateEcheance(dto.getDateEcheance());
|
||||
facture.setDatePaiement(dto.getDatePaiement());
|
||||
facture.setStatut(dto.getStatut() != null ? dto.getStatut() : Facture.StatutFacture.BROUILLON);
|
||||
facture.setMontantHT(dto.getMontantHT());
|
||||
facture.setTauxTVA(dto.getTauxTVA() != null ? dto.getTauxTVA() : BigDecimal.valueOf(20.0));
|
||||
facture.setMontantPaye(dto.getMontantPaye());
|
||||
facture.setConditionsPaiement(dto.getConditionsPaiement());
|
||||
facture.setTypeFacture(dto.getTypeFacture() != null ? dto.getTypeFacture() : Facture.TypeFacture.FACTURE);
|
||||
facture.setActif(true);
|
||||
facture.setClient(client);
|
||||
facture.setChantier(chantier);
|
||||
facture.setDevis(devis);
|
||||
|
||||
// Créer les lignes de facture si présentes
|
||||
if (dto.getLignes() != null && !dto.getLignes().isEmpty()) {
|
||||
List<LigneFacture> lignes = new ArrayList<>();
|
||||
int ordre = 1;
|
||||
for (FactureCreateDTO.LigneFactureCreateDTO ligneDTO : dto.getLignes()) {
|
||||
LigneFacture ligne = new LigneFacture();
|
||||
ligne.setDesignation(ligneDTO.getDescription()); // designation = description dans le DTO
|
||||
ligne.setDescription(ligneDTO.getDescription()); // description optionnelle
|
||||
ligne.setQuantite(ligneDTO.getQuantite());
|
||||
ligne.setPrixUnitaire(ligneDTO.getPrixUnitaire());
|
||||
ligne.setUnite(ligneDTO.getUnite() != null ? ligneDTO.getUnite() : "unité");
|
||||
ligne.setOrdre(ordre++);
|
||||
ligne.setFacture(facture);
|
||||
lignes.add(ligne);
|
||||
}
|
||||
facture.setLignes(lignes);
|
||||
}
|
||||
|
||||
return facture;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mise à jour d'entité depuis DTO
|
||||
*
|
||||
* @param facture L'entité à mettre à jour
|
||||
* @param dto Le DTO contenant les nouvelles valeurs
|
||||
* @param client Le client associé (peut être null si non modifié)
|
||||
* @param chantier Le chantier associé (peut être null si non modifié)
|
||||
* @param devis Le devis associé (peut être null si non modifié)
|
||||
*/
|
||||
public void updateEntity(Facture facture, FactureCreateDTO dto, Client client, Chantier chantier, Devis devis) {
|
||||
if (facture == null || dto == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
facture.setNumero(dto.getNumero());
|
||||
facture.setObjet(dto.getObjet());
|
||||
facture.setDescription(dto.getDescription());
|
||||
facture.setDateEmission(dto.getDateEmission());
|
||||
facture.setDateEcheance(dto.getDateEcheance());
|
||||
facture.setDatePaiement(dto.getDatePaiement());
|
||||
if (dto.getStatut() != null) {
|
||||
facture.setStatut(dto.getStatut());
|
||||
}
|
||||
facture.setMontantHT(dto.getMontantHT());
|
||||
if (dto.getTauxTVA() != null) {
|
||||
facture.setTauxTVA(dto.getTauxTVA());
|
||||
}
|
||||
facture.setMontantPaye(dto.getMontantPaye());
|
||||
facture.setConditionsPaiement(dto.getConditionsPaiement());
|
||||
if (dto.getTypeFacture() != null) {
|
||||
facture.setTypeFacture(dto.getTypeFacture());
|
||||
}
|
||||
if (client != null) {
|
||||
facture.setClient(client);
|
||||
}
|
||||
if (chantier != null) {
|
||||
facture.setChantier(chantier);
|
||||
}
|
||||
if (devis != null) {
|
||||
facture.setDevis(devis);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Conversion entité vers ResponseDTO
|
||||
*
|
||||
* @param facture L'entité Facture
|
||||
* @return Le DTO de réponse
|
||||
*/
|
||||
public FactureResponseDTO toResponseDTO(Facture facture) {
|
||||
if (facture == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
FactureResponseDTO dto = FactureResponseDTO.builder()
|
||||
.id(facture.getId())
|
||||
.numero(facture.getNumero())
|
||||
.objet(facture.getObjet())
|
||||
.description(facture.getDescription())
|
||||
.dateEmission(facture.getDateEmission())
|
||||
.dateEcheance(facture.getDateEcheance())
|
||||
.datePaiement(facture.getDatePaiement())
|
||||
.statut(facture.getStatut())
|
||||
.montantHT(facture.getMontantHT())
|
||||
.tauxTVA(facture.getTauxTVA())
|
||||
.montantTVA(facture.getMontantTVA())
|
||||
.montantTTC(facture.getMontantTTC())
|
||||
.montantPaye(facture.getMontantPaye())
|
||||
.montantRestant(facture.getMontantRestant())
|
||||
.conditionsPaiement(facture.getConditionsPaiement())
|
||||
.typeFacture(facture.getTypeFacture())
|
||||
.actif(facture.getActif())
|
||||
.dateCreation(facture.getDateCreation())
|
||||
.dateModification(facture.getDateModification())
|
||||
.build();
|
||||
|
||||
// Relations simplifiées
|
||||
if (facture.getClient() != null) {
|
||||
dto.setClientId(facture.getClient().getId());
|
||||
dto.setClientNom(facture.getClient().getNomComplet());
|
||||
dto.setClientRaisonSociale(facture.getClient().getEntreprise());
|
||||
}
|
||||
|
||||
if (facture.getChantier() != null) {
|
||||
dto.setChantierId(facture.getChantier().getId());
|
||||
dto.setChantierNom(facture.getChantier().getNom());
|
||||
}
|
||||
|
||||
if (facture.getDevis() != null) {
|
||||
dto.setDevisId(facture.getDevis().getId());
|
||||
dto.setDevisNumero(facture.getDevis().getNumero());
|
||||
}
|
||||
|
||||
// Convertir les lignes
|
||||
if (facture.getLignes() != null && !facture.getLignes().isEmpty()) {
|
||||
List<FactureResponseDTO.LigneFactureResponseDTO> lignesDTO = facture.getLignes().stream()
|
||||
.map(this::toLigneResponseDTO)
|
||||
.collect(Collectors.toList());
|
||||
dto.setLignes(lignesDTO);
|
||||
}
|
||||
|
||||
return dto;
|
||||
}
|
||||
|
||||
/**
|
||||
* Conversion d'une ligne de facture vers ResponseDTO
|
||||
*/
|
||||
private FactureResponseDTO.LigneFactureResponseDTO toLigneResponseDTO(LigneFacture ligne) {
|
||||
if (ligne == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Calculer les montants HT, TVA, TTC à partir du montantLigne et du tauxTVA de la facture
|
||||
BigDecimal montantHT = ligne.getMontantLigne();
|
||||
BigDecimal tauxTVA = ligne.getFacture() != null && ligne.getFacture().getTauxTVA() != null
|
||||
? ligne.getFacture().getTauxTVA()
|
||||
: BigDecimal.valueOf(20.0);
|
||||
BigDecimal montantTVA = montantHT != null
|
||||
? montantHT.multiply(tauxTVA).divide(BigDecimal.valueOf(100), 2, java.math.RoundingMode.HALF_UP)
|
||||
: null;
|
||||
BigDecimal montantTTC = montantHT != null && montantTVA != null
|
||||
? montantHT.add(montantTVA)
|
||||
: montantHT;
|
||||
|
||||
return FactureResponseDTO.LigneFactureResponseDTO.builder()
|
||||
.id(ligne.getId())
|
||||
.description(ligne.getDesignation() != null ? ligne.getDesignation() : ligne.getDescription())
|
||||
.quantite(ligne.getQuantite())
|
||||
.prixUnitaire(ligne.getPrixUnitaire())
|
||||
.tauxTVA(tauxTVA)
|
||||
.montantHT(montantHT)
|
||||
.montantTVA(montantTVA)
|
||||
.montantTTC(montantTTC)
|
||||
.unite(ligne.getUnite())
|
||||
.ordre(ligne.getOrdre())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.mapper;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.*;
|
||||
import dev.lions.btpxpress.domain.shared.dto.*;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Mapper pour les factures - Architecture 2025
|
||||
* Suit le même pattern que ChantierMapper et ClientMapper
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@ApplicationScoped
|
||||
public class FactureMapper {
|
||||
|
||||
/**
|
||||
* Conversion DTO vers entité
|
||||
*
|
||||
* @param dto Le DTO de création
|
||||
* @param client Le client associé (chargé depuis le repository)
|
||||
* @param chantier Le chantier associé (optionnel, peut être null)
|
||||
* @param devis Le devis associé (optionnel, peut être null)
|
||||
* @return L'entité Facture créée
|
||||
*/
|
||||
public Facture toEntity(FactureCreateDTO dto, Client client, Chantier chantier, Devis devis) {
|
||||
if (dto == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Facture facture = new Facture();
|
||||
facture.setNumero(dto.getNumero());
|
||||
facture.setObjet(dto.getObjet());
|
||||
facture.setDescription(dto.getDescription());
|
||||
facture.setDateEmission(dto.getDateEmission());
|
||||
facture.setDateEcheance(dto.getDateEcheance());
|
||||
facture.setDatePaiement(dto.getDatePaiement());
|
||||
facture.setStatut(dto.getStatut() != null ? dto.getStatut() : Facture.StatutFacture.BROUILLON);
|
||||
facture.setMontantHT(dto.getMontantHT());
|
||||
facture.setTauxTVA(dto.getTauxTVA() != null ? dto.getTauxTVA() : BigDecimal.valueOf(20.0));
|
||||
facture.setMontantPaye(dto.getMontantPaye());
|
||||
facture.setConditionsPaiement(dto.getConditionsPaiement());
|
||||
facture.setTypeFacture(dto.getTypeFacture() != null ? dto.getTypeFacture() : Facture.TypeFacture.FACTURE);
|
||||
facture.setActif(true);
|
||||
facture.setClient(client);
|
||||
facture.setChantier(chantier);
|
||||
facture.setDevis(devis);
|
||||
|
||||
// Créer les lignes de facture si présentes
|
||||
if (dto.getLignes() != null && !dto.getLignes().isEmpty()) {
|
||||
List<LigneFacture> lignes = new ArrayList<>();
|
||||
int ordre = 1;
|
||||
for (FactureCreateDTO.LigneFactureCreateDTO ligneDTO : dto.getLignes()) {
|
||||
LigneFacture ligne = new LigneFacture();
|
||||
ligne.setDesignation(ligneDTO.getDescription()); // designation = description dans le DTO
|
||||
ligne.setDescription(ligneDTO.getDescription()); // description optionnelle
|
||||
ligne.setQuantite(ligneDTO.getQuantite());
|
||||
ligne.setPrixUnitaire(ligneDTO.getPrixUnitaire());
|
||||
ligne.setUnite(ligneDTO.getUnite() != null ? ligneDTO.getUnite() : "unité");
|
||||
ligne.setOrdre(ordre++);
|
||||
ligne.setFacture(facture);
|
||||
lignes.add(ligne);
|
||||
}
|
||||
facture.setLignes(lignes);
|
||||
}
|
||||
|
||||
return facture;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mise à jour d'entité depuis DTO
|
||||
*
|
||||
* @param facture L'entité à mettre à jour
|
||||
* @param dto Le DTO contenant les nouvelles valeurs
|
||||
* @param client Le client associé (peut être null si non modifié)
|
||||
* @param chantier Le chantier associé (peut être null si non modifié)
|
||||
* @param devis Le devis associé (peut être null si non modifié)
|
||||
*/
|
||||
public void updateEntity(Facture facture, FactureCreateDTO dto, Client client, Chantier chantier, Devis devis) {
|
||||
if (facture == null || dto == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
facture.setNumero(dto.getNumero());
|
||||
facture.setObjet(dto.getObjet());
|
||||
facture.setDescription(dto.getDescription());
|
||||
facture.setDateEmission(dto.getDateEmission());
|
||||
facture.setDateEcheance(dto.getDateEcheance());
|
||||
facture.setDatePaiement(dto.getDatePaiement());
|
||||
if (dto.getStatut() != null) {
|
||||
facture.setStatut(dto.getStatut());
|
||||
}
|
||||
facture.setMontantHT(dto.getMontantHT());
|
||||
if (dto.getTauxTVA() != null) {
|
||||
facture.setTauxTVA(dto.getTauxTVA());
|
||||
}
|
||||
facture.setMontantPaye(dto.getMontantPaye());
|
||||
facture.setConditionsPaiement(dto.getConditionsPaiement());
|
||||
if (dto.getTypeFacture() != null) {
|
||||
facture.setTypeFacture(dto.getTypeFacture());
|
||||
}
|
||||
if (client != null) {
|
||||
facture.setClient(client);
|
||||
}
|
||||
if (chantier != null) {
|
||||
facture.setChantier(chantier);
|
||||
}
|
||||
if (devis != null) {
|
||||
facture.setDevis(devis);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Conversion entité vers ResponseDTO
|
||||
*
|
||||
* @param facture L'entité Facture
|
||||
* @return Le DTO de réponse
|
||||
*/
|
||||
public FactureResponseDTO toResponseDTO(Facture facture) {
|
||||
if (facture == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
FactureResponseDTO dto = FactureResponseDTO.builder()
|
||||
.id(facture.getId())
|
||||
.numero(facture.getNumero())
|
||||
.objet(facture.getObjet())
|
||||
.description(facture.getDescription())
|
||||
.dateEmission(facture.getDateEmission())
|
||||
.dateEcheance(facture.getDateEcheance())
|
||||
.datePaiement(facture.getDatePaiement())
|
||||
.statut(facture.getStatut())
|
||||
.montantHT(facture.getMontantHT())
|
||||
.tauxTVA(facture.getTauxTVA())
|
||||
.montantTVA(facture.getMontantTVA())
|
||||
.montantTTC(facture.getMontantTTC())
|
||||
.montantPaye(facture.getMontantPaye())
|
||||
.montantRestant(facture.getMontantRestant())
|
||||
.conditionsPaiement(facture.getConditionsPaiement())
|
||||
.typeFacture(facture.getTypeFacture())
|
||||
.actif(facture.getActif())
|
||||
.dateCreation(facture.getDateCreation())
|
||||
.dateModification(facture.getDateModification())
|
||||
.build();
|
||||
|
||||
// Relations simplifiées
|
||||
if (facture.getClient() != null) {
|
||||
dto.setClientId(facture.getClient().getId());
|
||||
dto.setClientNom(facture.getClient().getNomComplet());
|
||||
dto.setClientRaisonSociale(facture.getClient().getEntreprise());
|
||||
}
|
||||
|
||||
if (facture.getChantier() != null) {
|
||||
dto.setChantierId(facture.getChantier().getId());
|
||||
dto.setChantierNom(facture.getChantier().getNom());
|
||||
}
|
||||
|
||||
if (facture.getDevis() != null) {
|
||||
dto.setDevisId(facture.getDevis().getId());
|
||||
dto.setDevisNumero(facture.getDevis().getNumero());
|
||||
}
|
||||
|
||||
// Convertir les lignes
|
||||
if (facture.getLignes() != null && !facture.getLignes().isEmpty()) {
|
||||
List<FactureResponseDTO.LigneFactureResponseDTO> lignesDTO = facture.getLignes().stream()
|
||||
.map(this::toLigneResponseDTO)
|
||||
.collect(Collectors.toList());
|
||||
dto.setLignes(lignesDTO);
|
||||
}
|
||||
|
||||
return dto;
|
||||
}
|
||||
|
||||
/**
|
||||
* Conversion d'une ligne de facture vers ResponseDTO
|
||||
*/
|
||||
private FactureResponseDTO.LigneFactureResponseDTO toLigneResponseDTO(LigneFacture ligne) {
|
||||
if (ligne == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Calculer les montants HT, TVA, TTC à partir du montantLigne et du tauxTVA de la facture
|
||||
BigDecimal montantHT = ligne.getMontantLigne();
|
||||
BigDecimal tauxTVA = ligne.getFacture() != null && ligne.getFacture().getTauxTVA() != null
|
||||
? ligne.getFacture().getTauxTVA()
|
||||
: BigDecimal.valueOf(20.0);
|
||||
BigDecimal montantTVA = montantHT != null
|
||||
? montantHT.multiply(tauxTVA).divide(BigDecimal.valueOf(100), 2, java.math.RoundingMode.HALF_UP)
|
||||
: null;
|
||||
BigDecimal montantTTC = montantHT != null && montantTVA != null
|
||||
? montantHT.add(montantTVA)
|
||||
: montantHT;
|
||||
|
||||
return FactureResponseDTO.LigneFactureResponseDTO.builder()
|
||||
.id(ligne.getId())
|
||||
.description(ligne.getDesignation() != null ? ligne.getDesignation() : ligne.getDescription())
|
||||
.quantite(ligne.getQuantite())
|
||||
.prixUnitaire(ligne.getPrixUnitaire())
|
||||
.tauxTVA(tauxTVA)
|
||||
.montantHT(montantHT)
|
||||
.montantTVA(montantTVA)
|
||||
.montantTTC(montantTTC)
|
||||
.unite(ligne.getUnite())
|
||||
.ordre(ligne.getOrdre())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,81 +1,81 @@
|
||||
package dev.lions.btpxpress.domain.shared.mapper;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.Fournisseur;
|
||||
import dev.lions.btpxpress.domain.shared.dto.FournisseurCreateDTO;
|
||||
import dev.lions.btpxpress.domain.shared.dto.FournisseurResponseDTO;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
|
||||
/**
|
||||
* Mapper pour les fournisseurs - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@ApplicationScoped
|
||||
public class FournisseurMapper {
|
||||
|
||||
/**
|
||||
* Conversion DTO vers entité
|
||||
*/
|
||||
public Fournisseur toEntity(FournisseurCreateDTO dto) {
|
||||
if (dto == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Fournisseur fournisseur = Fournisseur.builder()
|
||||
.nom(dto.getNom())
|
||||
.contact(dto.getContact())
|
||||
.telephone(dto.getTelephone())
|
||||
.email(dto.getEmail())
|
||||
.adresse(dto.getAdresse())
|
||||
.ville(dto.getVille())
|
||||
.codePostal(dto.getCodePostal())
|
||||
.pays(dto.getPays())
|
||||
.siret(dto.getSiret())
|
||||
.tva(dto.getTva())
|
||||
.conditionsPaiement(dto.getConditionsPaiement())
|
||||
.delaiLivraison(dto.getDelaiLivraison())
|
||||
.note(dto.getNote())
|
||||
.actif(dto.getActif() != null ? dto.getActif() : true)
|
||||
.build();
|
||||
|
||||
return fournisseur;
|
||||
}
|
||||
|
||||
/**
|
||||
* Conversion entité vers ResponseDTO
|
||||
*/
|
||||
public FournisseurResponseDTO toResponseDTO(Fournisseur fournisseur) {
|
||||
if (fournisseur == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
FournisseurResponseDTO dto = FournisseurResponseDTO.builder()
|
||||
.id(fournisseur.getId())
|
||||
.nom(fournisseur.getNom())
|
||||
.contact(fournisseur.getContact())
|
||||
.telephone(fournisseur.getTelephone())
|
||||
.email(fournisseur.getEmail())
|
||||
.adresse(fournisseur.getAdresse())
|
||||
.ville(fournisseur.getVille())
|
||||
.codePostal(fournisseur.getCodePostal())
|
||||
.pays(fournisseur.getPays())
|
||||
.siret(fournisseur.getSiret())
|
||||
.tva(fournisseur.getTva())
|
||||
.conditionsPaiement(fournisseur.getConditionsPaiement())
|
||||
.delaiLivraison(fournisseur.getDelaiLivraison())
|
||||
.note(fournisseur.getNote())
|
||||
.actif(fournisseur.getActif())
|
||||
.dateCreation(fournisseur.getDateCreation())
|
||||
.dateModification(fournisseur.getDateModification())
|
||||
.build();
|
||||
|
||||
// Métadonnées calculées
|
||||
dto.setResume(fournisseur.getResume());
|
||||
dto.setComplet(fournisseur.isComplet());
|
||||
|
||||
return dto;
|
||||
}
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.mapper;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.Fournisseur;
|
||||
import dev.lions.btpxpress.domain.shared.dto.FournisseurCreateDTO;
|
||||
import dev.lions.btpxpress.domain.shared.dto.FournisseurResponseDTO;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
|
||||
/**
|
||||
* Mapper pour les fournisseurs - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@ApplicationScoped
|
||||
public class FournisseurMapper {
|
||||
|
||||
/**
|
||||
* Conversion DTO vers entité
|
||||
*/
|
||||
public Fournisseur toEntity(FournisseurCreateDTO dto) {
|
||||
if (dto == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Fournisseur fournisseur = Fournisseur.builder()
|
||||
.nom(dto.getNom())
|
||||
.contact(dto.getContact())
|
||||
.telephone(dto.getTelephone())
|
||||
.email(dto.getEmail())
|
||||
.adresse(dto.getAdresse())
|
||||
.ville(dto.getVille())
|
||||
.codePostal(dto.getCodePostal())
|
||||
.pays(dto.getPays())
|
||||
.siret(dto.getSiret())
|
||||
.tva(dto.getTva())
|
||||
.conditionsPaiement(dto.getConditionsPaiement())
|
||||
.delaiLivraison(dto.getDelaiLivraison())
|
||||
.note(dto.getNote())
|
||||
.actif(dto.getActif() != null ? dto.getActif() : true)
|
||||
.build();
|
||||
|
||||
return fournisseur;
|
||||
}
|
||||
|
||||
/**
|
||||
* Conversion entité vers ResponseDTO
|
||||
*/
|
||||
public FournisseurResponseDTO toResponseDTO(Fournisseur fournisseur) {
|
||||
if (fournisseur == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
FournisseurResponseDTO dto = FournisseurResponseDTO.builder()
|
||||
.id(fournisseur.getId())
|
||||
.nom(fournisseur.getNom())
|
||||
.contact(fournisseur.getContact())
|
||||
.telephone(fournisseur.getTelephone())
|
||||
.email(fournisseur.getEmail())
|
||||
.adresse(fournisseur.getAdresse())
|
||||
.ville(fournisseur.getVille())
|
||||
.codePostal(fournisseur.getCodePostal())
|
||||
.pays(fournisseur.getPays())
|
||||
.siret(fournisseur.getSiret())
|
||||
.tva(fournisseur.getTva())
|
||||
.conditionsPaiement(fournisseur.getConditionsPaiement())
|
||||
.delaiLivraison(fournisseur.getDelaiLivraison())
|
||||
.note(fournisseur.getNote())
|
||||
.actif(fournisseur.getActif())
|
||||
.dateCreation(fournisseur.getDateCreation())
|
||||
.dateModification(fournisseur.getDateModification())
|
||||
.build();
|
||||
|
||||
// Métadonnées calculées
|
||||
dto.setResume(fournisseur.getResume());
|
||||
dto.setComplet(fournisseur.isComplet());
|
||||
|
||||
return dto;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,162 +1,162 @@
|
||||
package dev.lions.btpxpress.domain.shared.mapper;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.LivraisonMateriel;
|
||||
import dev.lions.btpxpress.domain.shared.dto.LivraisonMaterielCreateDTO;
|
||||
import dev.lions.btpxpress.domain.shared.dto.LivraisonMaterielResponseDTO;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
|
||||
/**
|
||||
* Mapper pour les livraisons de matériel - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@ApplicationScoped
|
||||
public class LivraisonMaterielMapper {
|
||||
|
||||
/**
|
||||
* Conversion DTO vers entité
|
||||
*/
|
||||
public LivraisonMateriel toEntity(LivraisonMaterielCreateDTO dto) {
|
||||
if (dto == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
LivraisonMateriel livraison = LivraisonMateriel.builder()
|
||||
.numeroLivraison(dto.getNumeroLivraison())
|
||||
.referenceCommande(dto.getReferenceCommande())
|
||||
.typeTransport(dto.getTypeTransport())
|
||||
.statut(dto.getStatut() != null ? dto.getStatut() : dev.lions.btpxpress.domain.core.entity.StatutLivraison.PLANIFIEE)
|
||||
.dateLivraisonPrevue(dto.getDateLivraisonPrevue())
|
||||
.heureLivraisonPrevue(dto.getHeureLivraisonPrevue())
|
||||
.dureePrevueMinutes(dto.getDureePrevueMinutes())
|
||||
.transporteur(dto.getTransporteur())
|
||||
.chauffeur(dto.getChauffeur())
|
||||
.telephoneChauffeur(dto.getTelephoneChauffeur())
|
||||
.immatriculation(dto.getImmatriculation())
|
||||
.poidsChargeKg(dto.getPoidsChargeKg())
|
||||
.volumeChargeM3(dto.getVolumeChargeM3())
|
||||
.adresseDepart(dto.getAdresseDepart())
|
||||
.latitudeDepart(dto.getLatitudeDepart())
|
||||
.longitudeDepart(dto.getLongitudeDepart())
|
||||
.adresseDestination(dto.getAdresseDestination())
|
||||
.latitudeDestination(dto.getLatitudeDestination())
|
||||
.longitudeDestination(dto.getLongitudeDestination())
|
||||
.distanceKm(dto.getDistanceKm())
|
||||
.dureeTrajetPrevueMinutes(dto.getDureeTrajetPrevueMinutes())
|
||||
.contactReception(dto.getContactReception())
|
||||
.telephoneContact(dto.getTelephoneContact())
|
||||
.instructionsSpeciales(dto.getInstructionsSpeciales())
|
||||
.accesChantier(dto.getAccesChantier())
|
||||
.heureDepartPrevue(dto.getHeureDepartPrevue())
|
||||
.heureArriveePrevue(dto.getHeureArriveePrevue())
|
||||
.build();
|
||||
|
||||
return livraison;
|
||||
}
|
||||
|
||||
/**
|
||||
* Conversion entité vers ResponseDTO
|
||||
*/
|
||||
public LivraisonMaterielResponseDTO toResponseDTO(LivraisonMateriel livraison) {
|
||||
if (livraison == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
LivraisonMaterielResponseDTO dto = LivraisonMaterielResponseDTO.builder()
|
||||
.id(livraison.getId())
|
||||
.numeroLivraison(livraison.getNumeroLivraison())
|
||||
.referenceCommande(livraison.getReferenceCommande())
|
||||
.typeTransport(livraison.getTypeTransport())
|
||||
.statut(livraison.getStatut())
|
||||
.dateLivraisonPrevue(livraison.getDateLivraisonPrevue())
|
||||
.heureLivraisonPrevue(livraison.getHeureLivraisonPrevue())
|
||||
.dateLivraisonReelle(livraison.getDateLivraisonReelle())
|
||||
.heureLivraisonReelle(livraison.getHeureLivraisonReelle())
|
||||
.dureePrevueMinutes(livraison.getDureePrevueMinutes())
|
||||
.dureeReelleMinutes(livraison.getDureeReelleMinutes())
|
||||
.transporteur(livraison.getTransporteur())
|
||||
.chauffeur(livraison.getChauffeur())
|
||||
.telephoneChauffeur(livraison.getTelephoneChauffeur())
|
||||
.immatriculation(livraison.getImmatriculation())
|
||||
.poidsChargeKg(livraison.getPoidsChargeKg())
|
||||
.volumeChargeM3(livraison.getVolumeChargeM3())
|
||||
.adresseDepart(livraison.getAdresseDepart())
|
||||
.latitudeDepart(livraison.getLatitudeDepart())
|
||||
.longitudeDepart(livraison.getLongitudeDepart())
|
||||
.adresseDestination(livraison.getAdresseDestination())
|
||||
.latitudeDestination(livraison.getLatitudeDestination())
|
||||
.longitudeDestination(livraison.getLongitudeDestination())
|
||||
.distanceKm(livraison.getDistanceKm())
|
||||
.dureeTrajetPrevueMinutes(livraison.getDureeTrajetPrevueMinutes())
|
||||
.dureeTrajetReelleMinutes(livraison.getDureeTrajetReelleMinutes())
|
||||
.contactReception(livraison.getContactReception())
|
||||
.telephoneContact(livraison.getTelephoneContact())
|
||||
.instructionsSpeciales(livraison.getInstructionsSpeciales())
|
||||
.accesChantier(livraison.getAccesChantier())
|
||||
.heureDepartPrevue(livraison.getHeureDepartPrevue())
|
||||
.heureDepartReelle(livraison.getHeureDepartReelle())
|
||||
.heureArriveePrevue(livraison.getHeureArriveePrevue())
|
||||
.heureArriveeReelle(livraison.getHeureArriveeReelle())
|
||||
.tempsChargementMinutes(livraison.getTempsChargementMinutes())
|
||||
.tempsDechargementMinutes(livraison.getTempsDechargementMinutes())
|
||||
.etatMaterielDepart(livraison.getEtatMaterielDepart())
|
||||
.etatMaterielArrivee(livraison.getEtatMaterielArrivee())
|
||||
.quantiteLivree(livraison.getQuantiteLivree())
|
||||
.quantiteCommandee(livraison.getQuantiteCommandee())
|
||||
.conformiteLivraison(livraison.getConformiteLivraison())
|
||||
.observationsChauffeur(livraison.getObservationsChauffeur())
|
||||
.observationsReceptionnaire(livraison.getObservationsReceptionnaire())
|
||||
.signatureReceptionnaire(livraison.getSignatureReceptionnaire())
|
||||
.photoLivraison(livraison.getPhotoLivraison())
|
||||
.coutTransport(livraison.getCoutTransport())
|
||||
.coutCarburant(livraison.getCoutCarburant())
|
||||
.coutPeages(livraison.getCoutPeages())
|
||||
.coutTotal(livraison.getCoutTotal())
|
||||
.facture(livraison.getFacture())
|
||||
.incidentDetecte(livraison.getIncidentDetecte())
|
||||
.typeIncident(livraison.getTypeIncident())
|
||||
.descriptionIncident(livraison.getDescriptionIncident())
|
||||
.impactIncident(livraison.getImpactIncident())
|
||||
.actionsCorrectives(livraison.getActionsCorrectives())
|
||||
.trackingActive(livraison.getTrackingActive())
|
||||
.dernierePositionLat(livraison.getDernierePositionLat())
|
||||
.dernierePositionLng(livraison.getDernierePositionLng())
|
||||
.derniereMiseAJourGps(livraison.getDerniereMiseAJourGps())
|
||||
.vitesseActuelleKmh(livraison.getVitesseActuelleKmh())
|
||||
.dateCreation(livraison.getDateCreation())
|
||||
.dateModification(livraison.getDateModification())
|
||||
.planificateur(livraison.getPlanificateur())
|
||||
.derniereModificationPar(livraison.getDerniereModificationPar())
|
||||
.actif(livraison.getActif())
|
||||
.build();
|
||||
|
||||
// Relations simplifiées
|
||||
if (livraison.getReservation() != null) {
|
||||
dto.setReservationId(livraison.getReservation().getId());
|
||||
dto.setReservationReference(livraison.getReservation().getReferenceReservation());
|
||||
}
|
||||
|
||||
if (livraison.getChantierDestination() != null) {
|
||||
dto.setChantierDestinationId(livraison.getChantierDestination().getId());
|
||||
dto.setChantierDestinationNom(livraison.getChantierDestination().getNom());
|
||||
}
|
||||
|
||||
// Métadonnées calculées
|
||||
dto.setDureeTotalePrevueMinutes(livraison.getDureeTotalePrevueMinutes());
|
||||
dto.setDureeTotaleReelleMinutes(livraison.getDureeTotaleReelleMinutes());
|
||||
dto.setRetardMinutes(livraison.getRetardMinutes());
|
||||
dto.setEstEnRetard(livraison.estEnRetard());
|
||||
dto.setEstConforme(livraison.estConforme());
|
||||
dto.setVitesseMoyenneKmh(livraison.getVitesseMoyenneKmh());
|
||||
dto.setIsTrackingDisponible(livraison.isTrackingDisponible());
|
||||
dto.setDistanceVersDestination(livraison.getDistanceVersDestination());
|
||||
dto.setHeureArriveeEstimee(livraison.getHeureArriveeEstimee());
|
||||
dto.setNecessiteManutention(livraison.necessiteManutention());
|
||||
dto.setPriorite(livraison.getPriorite());
|
||||
|
||||
return dto;
|
||||
}
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.mapper;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.LivraisonMateriel;
|
||||
import dev.lions.btpxpress.domain.shared.dto.LivraisonMaterielCreateDTO;
|
||||
import dev.lions.btpxpress.domain.shared.dto.LivraisonMaterielResponseDTO;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
|
||||
/**
|
||||
* Mapper pour les livraisons de matériel - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@ApplicationScoped
|
||||
public class LivraisonMaterielMapper {
|
||||
|
||||
/**
|
||||
* Conversion DTO vers entité
|
||||
*/
|
||||
public LivraisonMateriel toEntity(LivraisonMaterielCreateDTO dto) {
|
||||
if (dto == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
LivraisonMateriel livraison = LivraisonMateriel.builder()
|
||||
.numeroLivraison(dto.getNumeroLivraison())
|
||||
.referenceCommande(dto.getReferenceCommande())
|
||||
.typeTransport(dto.getTypeTransport())
|
||||
.statut(dto.getStatut() != null ? dto.getStatut() : dev.lions.btpxpress.domain.core.entity.StatutLivraison.PLANIFIEE)
|
||||
.dateLivraisonPrevue(dto.getDateLivraisonPrevue())
|
||||
.heureLivraisonPrevue(dto.getHeureLivraisonPrevue())
|
||||
.dureePrevueMinutes(dto.getDureePrevueMinutes())
|
||||
.transporteur(dto.getTransporteur())
|
||||
.chauffeur(dto.getChauffeur())
|
||||
.telephoneChauffeur(dto.getTelephoneChauffeur())
|
||||
.immatriculation(dto.getImmatriculation())
|
||||
.poidsChargeKg(dto.getPoidsChargeKg())
|
||||
.volumeChargeM3(dto.getVolumeChargeM3())
|
||||
.adresseDepart(dto.getAdresseDepart())
|
||||
.latitudeDepart(dto.getLatitudeDepart())
|
||||
.longitudeDepart(dto.getLongitudeDepart())
|
||||
.adresseDestination(dto.getAdresseDestination())
|
||||
.latitudeDestination(dto.getLatitudeDestination())
|
||||
.longitudeDestination(dto.getLongitudeDestination())
|
||||
.distanceKm(dto.getDistanceKm())
|
||||
.dureeTrajetPrevueMinutes(dto.getDureeTrajetPrevueMinutes())
|
||||
.contactReception(dto.getContactReception())
|
||||
.telephoneContact(dto.getTelephoneContact())
|
||||
.instructionsSpeciales(dto.getInstructionsSpeciales())
|
||||
.accesChantier(dto.getAccesChantier())
|
||||
.heureDepartPrevue(dto.getHeureDepartPrevue())
|
||||
.heureArriveePrevue(dto.getHeureArriveePrevue())
|
||||
.build();
|
||||
|
||||
return livraison;
|
||||
}
|
||||
|
||||
/**
|
||||
* Conversion entité vers ResponseDTO
|
||||
*/
|
||||
public LivraisonMaterielResponseDTO toResponseDTO(LivraisonMateriel livraison) {
|
||||
if (livraison == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
LivraisonMaterielResponseDTO dto = LivraisonMaterielResponseDTO.builder()
|
||||
.id(livraison.getId())
|
||||
.numeroLivraison(livraison.getNumeroLivraison())
|
||||
.referenceCommande(livraison.getReferenceCommande())
|
||||
.typeTransport(livraison.getTypeTransport())
|
||||
.statut(livraison.getStatut())
|
||||
.dateLivraisonPrevue(livraison.getDateLivraisonPrevue())
|
||||
.heureLivraisonPrevue(livraison.getHeureLivraisonPrevue())
|
||||
.dateLivraisonReelle(livraison.getDateLivraisonReelle())
|
||||
.heureLivraisonReelle(livraison.getHeureLivraisonReelle())
|
||||
.dureePrevueMinutes(livraison.getDureePrevueMinutes())
|
||||
.dureeReelleMinutes(livraison.getDureeReelleMinutes())
|
||||
.transporteur(livraison.getTransporteur())
|
||||
.chauffeur(livraison.getChauffeur())
|
||||
.telephoneChauffeur(livraison.getTelephoneChauffeur())
|
||||
.immatriculation(livraison.getImmatriculation())
|
||||
.poidsChargeKg(livraison.getPoidsChargeKg())
|
||||
.volumeChargeM3(livraison.getVolumeChargeM3())
|
||||
.adresseDepart(livraison.getAdresseDepart())
|
||||
.latitudeDepart(livraison.getLatitudeDepart())
|
||||
.longitudeDepart(livraison.getLongitudeDepart())
|
||||
.adresseDestination(livraison.getAdresseDestination())
|
||||
.latitudeDestination(livraison.getLatitudeDestination())
|
||||
.longitudeDestination(livraison.getLongitudeDestination())
|
||||
.distanceKm(livraison.getDistanceKm())
|
||||
.dureeTrajetPrevueMinutes(livraison.getDureeTrajetPrevueMinutes())
|
||||
.dureeTrajetReelleMinutes(livraison.getDureeTrajetReelleMinutes())
|
||||
.contactReception(livraison.getContactReception())
|
||||
.telephoneContact(livraison.getTelephoneContact())
|
||||
.instructionsSpeciales(livraison.getInstructionsSpeciales())
|
||||
.accesChantier(livraison.getAccesChantier())
|
||||
.heureDepartPrevue(livraison.getHeureDepartPrevue())
|
||||
.heureDepartReelle(livraison.getHeureDepartReelle())
|
||||
.heureArriveePrevue(livraison.getHeureArriveePrevue())
|
||||
.heureArriveeReelle(livraison.getHeureArriveeReelle())
|
||||
.tempsChargementMinutes(livraison.getTempsChargementMinutes())
|
||||
.tempsDechargementMinutes(livraison.getTempsDechargementMinutes())
|
||||
.etatMaterielDepart(livraison.getEtatMaterielDepart())
|
||||
.etatMaterielArrivee(livraison.getEtatMaterielArrivee())
|
||||
.quantiteLivree(livraison.getQuantiteLivree())
|
||||
.quantiteCommandee(livraison.getQuantiteCommandee())
|
||||
.conformiteLivraison(livraison.getConformiteLivraison())
|
||||
.observationsChauffeur(livraison.getObservationsChauffeur())
|
||||
.observationsReceptionnaire(livraison.getObservationsReceptionnaire())
|
||||
.signatureReceptionnaire(livraison.getSignatureReceptionnaire())
|
||||
.photoLivraison(livraison.getPhotoLivraison())
|
||||
.coutTransport(livraison.getCoutTransport())
|
||||
.coutCarburant(livraison.getCoutCarburant())
|
||||
.coutPeages(livraison.getCoutPeages())
|
||||
.coutTotal(livraison.getCoutTotal())
|
||||
.facture(livraison.getFacture())
|
||||
.incidentDetecte(livraison.getIncidentDetecte())
|
||||
.typeIncident(livraison.getTypeIncident())
|
||||
.descriptionIncident(livraison.getDescriptionIncident())
|
||||
.impactIncident(livraison.getImpactIncident())
|
||||
.actionsCorrectives(livraison.getActionsCorrectives())
|
||||
.trackingActive(livraison.getTrackingActive())
|
||||
.dernierePositionLat(livraison.getDernierePositionLat())
|
||||
.dernierePositionLng(livraison.getDernierePositionLng())
|
||||
.derniereMiseAJourGps(livraison.getDerniereMiseAJourGps())
|
||||
.vitesseActuelleKmh(livraison.getVitesseActuelleKmh())
|
||||
.dateCreation(livraison.getDateCreation())
|
||||
.dateModification(livraison.getDateModification())
|
||||
.planificateur(livraison.getPlanificateur())
|
||||
.derniereModificationPar(livraison.getDerniereModificationPar())
|
||||
.actif(livraison.getActif())
|
||||
.build();
|
||||
|
||||
// Relations simplifiées
|
||||
if (livraison.getReservation() != null) {
|
||||
dto.setReservationId(livraison.getReservation().getId());
|
||||
dto.setReservationReference(livraison.getReservation().getReferenceReservation());
|
||||
}
|
||||
|
||||
if (livraison.getChantierDestination() != null) {
|
||||
dto.setChantierDestinationId(livraison.getChantierDestination().getId());
|
||||
dto.setChantierDestinationNom(livraison.getChantierDestination().getNom());
|
||||
}
|
||||
|
||||
// Métadonnées calculées
|
||||
dto.setDureeTotalePrevueMinutes(livraison.getDureeTotalePrevueMinutes());
|
||||
dto.setDureeTotaleReelleMinutes(livraison.getDureeTotaleReelleMinutes());
|
||||
dto.setRetardMinutes(livraison.getRetardMinutes());
|
||||
dto.setEstEnRetard(livraison.estEnRetard());
|
||||
dto.setEstConforme(livraison.estConforme());
|
||||
dto.setVitesseMoyenneKmh(livraison.getVitesseMoyenneKmh());
|
||||
dto.setIsTrackingDisponible(livraison.isTrackingDisponible());
|
||||
dto.setDistanceVersDestination(livraison.getDistanceVersDestination());
|
||||
dto.setHeureArriveeEstimee(livraison.getHeureArriveeEstimee());
|
||||
dto.setNecessiteManutention(livraison.necessiteManutention());
|
||||
dto.setPriorite(livraison.getPriorite());
|
||||
|
||||
return dto;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,78 +1,78 @@
|
||||
package dev.lions.btpxpress.domain.shared.mapper;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.MaintenanceMateriel;
|
||||
import dev.lions.btpxpress.domain.shared.dto.MaintenanceCreateDTO;
|
||||
import dev.lions.btpxpress.domain.shared.dto.MaintenanceResponseDTO;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
|
||||
/**
|
||||
* Mapper pour les maintenances - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@ApplicationScoped
|
||||
public class MaintenanceMapper {
|
||||
|
||||
/**
|
||||
* Conversion DTO vers entité
|
||||
*/
|
||||
public MaintenanceMateriel toEntity(MaintenanceCreateDTO dto) {
|
||||
if (dto == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
MaintenanceMateriel maintenance = MaintenanceMateriel.builder()
|
||||
.type(dto.getType())
|
||||
.description(dto.getDescription())
|
||||
.datePrevue(dto.getDatePrevue())
|
||||
.dateRealisee(dto.getDateRealisee())
|
||||
.cout(dto.getCout())
|
||||
.statut(dto.getStatut() != null ? dto.getStatut() : dev.lions.btpxpress.domain.core.entity.StatutMaintenance.PLANIFIEE)
|
||||
.technicien(dto.getTechnicien())
|
||||
.notes(dto.getNotes())
|
||||
.prochaineMaintenance(dto.getProchaineMaintenance())
|
||||
.build();
|
||||
|
||||
return maintenance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Conversion entité vers ResponseDTO
|
||||
*/
|
||||
public MaintenanceResponseDTO toResponseDTO(MaintenanceMateriel maintenance) {
|
||||
if (maintenance == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
MaintenanceResponseDTO dto = MaintenanceResponseDTO.builder()
|
||||
.id(maintenance.getId())
|
||||
.type(maintenance.getType())
|
||||
.description(maintenance.getDescription())
|
||||
.datePrevue(maintenance.getDatePrevue())
|
||||
.dateRealisee(maintenance.getDateRealisee())
|
||||
.cout(maintenance.getCout())
|
||||
.statut(maintenance.getStatut())
|
||||
.technicien(maintenance.getTechnicien())
|
||||
.notes(maintenance.getNotes())
|
||||
.prochaineMaintenance(maintenance.getProchaineMaintenance())
|
||||
.dateCreation(maintenance.getDateCreation())
|
||||
.dateModification(maintenance.getDateModification())
|
||||
.build();
|
||||
|
||||
// Relations simplifiées
|
||||
if (maintenance.getMateriel() != null) {
|
||||
dto.setMaterielId(maintenance.getMateriel().getId());
|
||||
dto.setMaterielNom(maintenance.getMateriel().getNom());
|
||||
dto.setMaterielReference(maintenance.getMateriel().getNumeroSerie());
|
||||
}
|
||||
|
||||
// Métadonnées calculées
|
||||
dto.setEnRetard(maintenance.isEnRetard());
|
||||
dto.setTerminee(maintenance.isTerminee());
|
||||
|
||||
return dto;
|
||||
}
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.mapper;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.MaintenanceMateriel;
|
||||
import dev.lions.btpxpress.domain.shared.dto.MaintenanceCreateDTO;
|
||||
import dev.lions.btpxpress.domain.shared.dto.MaintenanceResponseDTO;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
|
||||
/**
|
||||
* Mapper pour les maintenances - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@ApplicationScoped
|
||||
public class MaintenanceMapper {
|
||||
|
||||
/**
|
||||
* Conversion DTO vers entité
|
||||
*/
|
||||
public MaintenanceMateriel toEntity(MaintenanceCreateDTO dto) {
|
||||
if (dto == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
MaintenanceMateriel maintenance = MaintenanceMateriel.builder()
|
||||
.type(dto.getType())
|
||||
.description(dto.getDescription())
|
||||
.datePrevue(dto.getDatePrevue())
|
||||
.dateRealisee(dto.getDateRealisee())
|
||||
.cout(dto.getCout())
|
||||
.statut(dto.getStatut() != null ? dto.getStatut() : dev.lions.btpxpress.domain.core.entity.StatutMaintenance.PLANIFIEE)
|
||||
.technicien(dto.getTechnicien())
|
||||
.notes(dto.getNotes())
|
||||
.prochaineMaintenance(dto.getProchaineMaintenance())
|
||||
.build();
|
||||
|
||||
return maintenance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Conversion entité vers ResponseDTO
|
||||
*/
|
||||
public MaintenanceResponseDTO toResponseDTO(MaintenanceMateriel maintenance) {
|
||||
if (maintenance == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
MaintenanceResponseDTO dto = MaintenanceResponseDTO.builder()
|
||||
.id(maintenance.getId())
|
||||
.type(maintenance.getType())
|
||||
.description(maintenance.getDescription())
|
||||
.datePrevue(maintenance.getDatePrevue())
|
||||
.dateRealisee(maintenance.getDateRealisee())
|
||||
.cout(maintenance.getCout())
|
||||
.statut(maintenance.getStatut())
|
||||
.technicien(maintenance.getTechnicien())
|
||||
.notes(maintenance.getNotes())
|
||||
.prochaineMaintenance(maintenance.getProchaineMaintenance())
|
||||
.dateCreation(maintenance.getDateCreation())
|
||||
.dateModification(maintenance.getDateModification())
|
||||
.build();
|
||||
|
||||
// Relations simplifiées
|
||||
if (maintenance.getMateriel() != null) {
|
||||
dto.setMaterielId(maintenance.getMateriel().getId());
|
||||
dto.setMaterielNom(maintenance.getMateriel().getNom());
|
||||
dto.setMaterielReference(maintenance.getMateriel().getNumeroSerie());
|
||||
}
|
||||
|
||||
// Métadonnées calculées
|
||||
dto.setEnRetard(maintenance.isEnRetard());
|
||||
dto.setTerminee(maintenance.isTerminee());
|
||||
|
||||
return dto;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,192 +1,192 @@
|
||||
package dev.lions.btpxpress.domain.shared.mapper;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.*;
|
||||
import dev.lions.btpxpress.domain.shared.dto.*;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* Mapper pour les matériels - Architecture 2025
|
||||
* Suit le même pattern que ChantierMapper et ClientMapper
|
||||
*
|
||||
* Note: Ce mapper gère Materiel (entité principale), pas MaterielBTP (entité technique détaillée)
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@ApplicationScoped
|
||||
public class MaterielMapper {
|
||||
|
||||
/**
|
||||
* Conversion DTO vers entité
|
||||
*
|
||||
* @param dto Le DTO de création
|
||||
* @return L'entité Materiel créée
|
||||
*/
|
||||
public Materiel toEntity(MaterielCreateDTO dto) {
|
||||
if (dto == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Materiel materiel = new Materiel();
|
||||
materiel.setNom(dto.getNom());
|
||||
materiel.setDescription(dto.getDescription());
|
||||
materiel.setNumeroSerie(dto.getCode()); // Utiliser code comme numeroSerie
|
||||
// Type sera déterminé par défaut ou laissé à null (sera requis par validation)
|
||||
materiel.setType(determineTypeMateriel(dto.getCategorie()));
|
||||
materiel.setLocalisation(dto.getLocalisation());
|
||||
materiel.setActif(dto.getActif() != null ? dto.getActif() : true);
|
||||
|
||||
// Gestion du stock
|
||||
if (dto.getStockDisponible() != null) {
|
||||
materiel.setQuantiteStock(BigDecimal.valueOf(dto.getStockDisponible()));
|
||||
}
|
||||
if (dto.getStockMinimum() != null) {
|
||||
materiel.setSeuilMinimum(BigDecimal.valueOf(dto.getStockMinimum()));
|
||||
}
|
||||
materiel.setUnite(dto.getUnite());
|
||||
|
||||
return materiel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mise à jour d'entité depuis DTO
|
||||
*
|
||||
* @param materiel L'entité à mettre à jour
|
||||
* @param dto Le DTO contenant les nouvelles valeurs
|
||||
*/
|
||||
public void updateEntity(Materiel materiel, MaterielCreateDTO dto) {
|
||||
if (materiel == null || dto == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
materiel.setNom(dto.getNom());
|
||||
materiel.setDescription(dto.getDescription());
|
||||
if (dto.getCode() != null) {
|
||||
materiel.setNumeroSerie(dto.getCode());
|
||||
}
|
||||
if (dto.getCategorie() != null) {
|
||||
materiel.setType(determineTypeMateriel(dto.getCategorie()));
|
||||
}
|
||||
materiel.setLocalisation(dto.getLocalisation());
|
||||
if (dto.getActif() != null) {
|
||||
materiel.setActif(dto.getActif());
|
||||
}
|
||||
|
||||
// Gestion du stock
|
||||
if (dto.getStockDisponible() != null) {
|
||||
materiel.setQuantiteStock(BigDecimal.valueOf(dto.getStockDisponible()));
|
||||
}
|
||||
if (dto.getStockMinimum() != null) {
|
||||
materiel.setSeuilMinimum(BigDecimal.valueOf(dto.getStockMinimum()));
|
||||
}
|
||||
if (dto.getUnite() != null) {
|
||||
materiel.setUnite(dto.getUnite());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Conversion entité vers ResponseDTO
|
||||
*
|
||||
* @param materiel L'entité Materiel
|
||||
* @return Le DTO de réponse
|
||||
*/
|
||||
public MaterielResponseDTO toResponseDTO(Materiel materiel) {
|
||||
if (materiel == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
MaterielResponseDTO dto = MaterielResponseDTO.builder()
|
||||
.id(materiel.getId())
|
||||
.code(materiel.getCode()) // Utiliser la méthode getCode() qui gère la génération
|
||||
.nom(materiel.getNom())
|
||||
.description(materiel.getDescription())
|
||||
.categorie(determineCategorieMateriel(materiel.getType()))
|
||||
.sousCategorie(null) // Pas de sous-catégorie dans Materiel
|
||||
.prixUnitaire(materiel.getValeurActuelle()) // Utiliser valeurActuelle comme prixUnitaire
|
||||
.unite(materiel.getUnite())
|
||||
.stockDisponible(materiel.getQuantiteStock() != null ? materiel.getQuantiteStock().intValue() : 0)
|
||||
.stockMinimum(materiel.getSeuilMinimum() != null ? materiel.getSeuilMinimum().intValue() : 0)
|
||||
.localisation(materiel.getLocalisation())
|
||||
.actif(materiel.getActif())
|
||||
.dateCreation(materiel.getDateCreation())
|
||||
.dateModification(materiel.getDateModification())
|
||||
.build();
|
||||
|
||||
// Relations simplifiées - Materiel n'a pas de relation directe avec Fournisseur
|
||||
// Le fournisseur est géré via CatalogueFournisseur
|
||||
dto.setFournisseurId(null);
|
||||
dto.setFournisseurNom(null);
|
||||
|
||||
// Compter les réservations et maintenances (si les relations sont chargées)
|
||||
if (materiel.getReservations() != null) {
|
||||
dto.setNombreReservations(materiel.getReservations().size());
|
||||
} else {
|
||||
dto.setNombreReservations(0);
|
||||
}
|
||||
|
||||
if (materiel.getMaintenances() != null) {
|
||||
dto.setNombreMaintenances(materiel.getMaintenances().size());
|
||||
} else {
|
||||
dto.setNombreMaintenances(0);
|
||||
}
|
||||
|
||||
return dto;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convertit CategorieMateriel (MaterielBTP) en TypeMateriel (Materiel)
|
||||
* Mapping simplifié - peut être amélioré selon les besoins métier
|
||||
*/
|
||||
private TypeMateriel determineTypeMateriel(MaterielBTP.CategorieMateriel categorie) {
|
||||
if (categorie == null) {
|
||||
return TypeMateriel.OUTILLAGE;
|
||||
}
|
||||
|
||||
// Mapping basique - à adapter selon les catégories réelles
|
||||
try {
|
||||
String categorieName = categorie.name();
|
||||
if (categorieName.contains("BETON") || categorieName.contains("CIMENT") || categorieName.contains("MORTIER")) {
|
||||
return TypeMateriel.MATERIAUX_CONSTRUCTION;
|
||||
} else if (categorieName.contains("OUTIL")) {
|
||||
return TypeMateriel.OUTILLAGE;
|
||||
} else if (categorieName.contains("EQUIPEMENT") || categorieName.contains("SECURITE")) {
|
||||
return TypeMateriel.EQUIPEMENT_SECURITE;
|
||||
} else if (categorieName.contains("VEHICULE") || categorieName.contains("ENGIN")) {
|
||||
return TypeMateriel.ENGIN_CHANTIER;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// En cas d'erreur, retourner OUTILLAGE par défaut
|
||||
}
|
||||
return TypeMateriel.OUTILLAGE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convertit TypeMateriel (Materiel) en CategorieMateriel (MaterielBTP)
|
||||
* Mapping simplifié - peut être amélioré selon les besoins métier
|
||||
*/
|
||||
private MaterielBTP.CategorieMateriel determineCategorieMateriel(TypeMateriel type) {
|
||||
if (type == null) {
|
||||
return MaterielBTP.CategorieMateriel.OUTILLAGE;
|
||||
}
|
||||
|
||||
// Mapping basique - à adapter selon les types réels
|
||||
try {
|
||||
String typeName = type.name();
|
||||
if (typeName.contains("MATERIAUX") || typeName.contains("CONSTRUCTION")) {
|
||||
return MaterielBTP.CategorieMateriel.GROS_OEUVRE;
|
||||
} else if (typeName.contains("OUTIL") || typeName.contains("OUTILLAGE")) {
|
||||
return MaterielBTP.CategorieMateriel.OUTILLAGE;
|
||||
} else if (typeName.contains("EQUIPEMENT") || typeName.contains("SECURITE")) {
|
||||
return MaterielBTP.CategorieMateriel.EQUIPEMENTS;
|
||||
} else if (typeName.contains("VEHICULE") || typeName.contains("ENGIN")) {
|
||||
return MaterielBTP.CategorieMateriel.EQUIPEMENTS;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// En cas d'erreur, retourner OUTILLAGE par défaut
|
||||
}
|
||||
return MaterielBTP.CategorieMateriel.OUTILLAGE;
|
||||
}
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.mapper;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.*;
|
||||
import dev.lions.btpxpress.domain.shared.dto.*;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* Mapper pour les matériels - Architecture 2025
|
||||
* Suit le même pattern que ChantierMapper et ClientMapper
|
||||
*
|
||||
* Note: Ce mapper gère Materiel (entité principale), pas MaterielBTP (entité technique détaillée)
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@ApplicationScoped
|
||||
public class MaterielMapper {
|
||||
|
||||
/**
|
||||
* Conversion DTO vers entité
|
||||
*
|
||||
* @param dto Le DTO de création
|
||||
* @return L'entité Materiel créée
|
||||
*/
|
||||
public Materiel toEntity(MaterielCreateDTO dto) {
|
||||
if (dto == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Materiel materiel = new Materiel();
|
||||
materiel.setNom(dto.getNom());
|
||||
materiel.setDescription(dto.getDescription());
|
||||
materiel.setNumeroSerie(dto.getCode()); // Utiliser code comme numeroSerie
|
||||
// Type sera déterminé par défaut ou laissé à null (sera requis par validation)
|
||||
materiel.setType(determineTypeMateriel(dto.getCategorie()));
|
||||
materiel.setLocalisation(dto.getLocalisation());
|
||||
materiel.setActif(dto.getActif() != null ? dto.getActif() : true);
|
||||
|
||||
// Gestion du stock
|
||||
if (dto.getStockDisponible() != null) {
|
||||
materiel.setQuantiteStock(BigDecimal.valueOf(dto.getStockDisponible()));
|
||||
}
|
||||
if (dto.getStockMinimum() != null) {
|
||||
materiel.setSeuilMinimum(BigDecimal.valueOf(dto.getStockMinimum()));
|
||||
}
|
||||
materiel.setUnite(dto.getUnite());
|
||||
|
||||
return materiel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mise à jour d'entité depuis DTO
|
||||
*
|
||||
* @param materiel L'entité à mettre à jour
|
||||
* @param dto Le DTO contenant les nouvelles valeurs
|
||||
*/
|
||||
public void updateEntity(Materiel materiel, MaterielCreateDTO dto) {
|
||||
if (materiel == null || dto == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
materiel.setNom(dto.getNom());
|
||||
materiel.setDescription(dto.getDescription());
|
||||
if (dto.getCode() != null) {
|
||||
materiel.setNumeroSerie(dto.getCode());
|
||||
}
|
||||
if (dto.getCategorie() != null) {
|
||||
materiel.setType(determineTypeMateriel(dto.getCategorie()));
|
||||
}
|
||||
materiel.setLocalisation(dto.getLocalisation());
|
||||
if (dto.getActif() != null) {
|
||||
materiel.setActif(dto.getActif());
|
||||
}
|
||||
|
||||
// Gestion du stock
|
||||
if (dto.getStockDisponible() != null) {
|
||||
materiel.setQuantiteStock(BigDecimal.valueOf(dto.getStockDisponible()));
|
||||
}
|
||||
if (dto.getStockMinimum() != null) {
|
||||
materiel.setSeuilMinimum(BigDecimal.valueOf(dto.getStockMinimum()));
|
||||
}
|
||||
if (dto.getUnite() != null) {
|
||||
materiel.setUnite(dto.getUnite());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Conversion entité vers ResponseDTO
|
||||
*
|
||||
* @param materiel L'entité Materiel
|
||||
* @return Le DTO de réponse
|
||||
*/
|
||||
public MaterielResponseDTO toResponseDTO(Materiel materiel) {
|
||||
if (materiel == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
MaterielResponseDTO dto = MaterielResponseDTO.builder()
|
||||
.id(materiel.getId())
|
||||
.code(materiel.getCode()) // Utiliser la méthode getCode() qui gère la génération
|
||||
.nom(materiel.getNom())
|
||||
.description(materiel.getDescription())
|
||||
.categorie(determineCategorieMateriel(materiel.getType()))
|
||||
.sousCategorie(null) // Pas de sous-catégorie dans Materiel
|
||||
.prixUnitaire(materiel.getValeurActuelle()) // Utiliser valeurActuelle comme prixUnitaire
|
||||
.unite(materiel.getUnite())
|
||||
.stockDisponible(materiel.getQuantiteStock() != null ? materiel.getQuantiteStock().intValue() : 0)
|
||||
.stockMinimum(materiel.getSeuilMinimum() != null ? materiel.getSeuilMinimum().intValue() : 0)
|
||||
.localisation(materiel.getLocalisation())
|
||||
.actif(materiel.getActif())
|
||||
.dateCreation(materiel.getDateCreation())
|
||||
.dateModification(materiel.getDateModification())
|
||||
.build();
|
||||
|
||||
// Relations simplifiées - Materiel n'a pas de relation directe avec Fournisseur
|
||||
// Le fournisseur est géré via CatalogueFournisseur
|
||||
dto.setFournisseurId(null);
|
||||
dto.setFournisseurNom(null);
|
||||
|
||||
// Compter les réservations et maintenances (si les relations sont chargées)
|
||||
if (materiel.getReservations() != null) {
|
||||
dto.setNombreReservations(materiel.getReservations().size());
|
||||
} else {
|
||||
dto.setNombreReservations(0);
|
||||
}
|
||||
|
||||
if (materiel.getMaintenances() != null) {
|
||||
dto.setNombreMaintenances(materiel.getMaintenances().size());
|
||||
} else {
|
||||
dto.setNombreMaintenances(0);
|
||||
}
|
||||
|
||||
return dto;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convertit CategorieMateriel (MaterielBTP) en TypeMateriel (Materiel)
|
||||
* Mapping simplifié - peut être amélioré selon les besoins métier
|
||||
*/
|
||||
private TypeMateriel determineTypeMateriel(MaterielBTP.CategorieMateriel categorie) {
|
||||
if (categorie == null) {
|
||||
return TypeMateriel.OUTILLAGE;
|
||||
}
|
||||
|
||||
// Mapping basique - à adapter selon les catégories réelles
|
||||
try {
|
||||
String categorieName = categorie.name();
|
||||
if (categorieName.contains("BETON") || categorieName.contains("CIMENT") || categorieName.contains("MORTIER")) {
|
||||
return TypeMateriel.MATERIAUX_CONSTRUCTION;
|
||||
} else if (categorieName.contains("OUTIL")) {
|
||||
return TypeMateriel.OUTILLAGE;
|
||||
} else if (categorieName.contains("EQUIPEMENT") || categorieName.contains("SECURITE")) {
|
||||
return TypeMateriel.EQUIPEMENT_SECURITE;
|
||||
} else if (categorieName.contains("VEHICULE") || categorieName.contains("ENGIN")) {
|
||||
return TypeMateriel.ENGIN_CHANTIER;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// En cas d'erreur, retourner OUTILLAGE par défaut
|
||||
}
|
||||
return TypeMateriel.OUTILLAGE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convertit TypeMateriel (Materiel) en CategorieMateriel (MaterielBTP)
|
||||
* Mapping simplifié - peut être amélioré selon les besoins métier
|
||||
*/
|
||||
private MaterielBTP.CategorieMateriel determineCategorieMateriel(TypeMateriel type) {
|
||||
if (type == null) {
|
||||
return MaterielBTP.CategorieMateriel.OUTILLAGE;
|
||||
}
|
||||
|
||||
// Mapping basique - à adapter selon les types réels
|
||||
try {
|
||||
String typeName = type.name();
|
||||
if (typeName.contains("MATERIAUX") || typeName.contains("CONSTRUCTION")) {
|
||||
return MaterielBTP.CategorieMateriel.GROS_OEUVRE;
|
||||
} else if (typeName.contains("OUTIL") || typeName.contains("OUTILLAGE")) {
|
||||
return MaterielBTP.CategorieMateriel.OUTILLAGE;
|
||||
} else if (typeName.contains("EQUIPEMENT") || typeName.contains("SECURITE")) {
|
||||
return MaterielBTP.CategorieMateriel.EQUIPEMENTS;
|
||||
} else if (typeName.contains("VEHICULE") || typeName.contains("ENGIN")) {
|
||||
return MaterielBTP.CategorieMateriel.EQUIPEMENTS;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// En cas d'erreur, retourner OUTILLAGE par défaut
|
||||
}
|
||||
return MaterielBTP.CategorieMateriel.OUTILLAGE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,103 +1,103 @@
|
||||
package dev.lions.btpxpress.domain.shared.mapper;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.Message;
|
||||
import dev.lions.btpxpress.domain.shared.dto.MessageCreateDTO;
|
||||
import dev.lions.btpxpress.domain.shared.dto.MessageResponseDTO;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
|
||||
/**
|
||||
* Mapper pour les messages - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@ApplicationScoped
|
||||
public class MessageMapper {
|
||||
|
||||
/**
|
||||
* Conversion DTO vers entité
|
||||
*/
|
||||
public Message toEntity(MessageCreateDTO dto) {
|
||||
if (dto == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Message message = Message.builder()
|
||||
.sujet(dto.getSujet())
|
||||
.contenu(dto.getContenu())
|
||||
.type(dto.getType() != null ? dto.getType() : dev.lions.btpxpress.domain.core.entity.TypeMessage.NORMAL)
|
||||
.priorite(dto.getPriorite() != null ? dto.getPriorite() : dev.lions.btpxpress.domain.core.entity.PrioriteMessage.NORMALE)
|
||||
.important(dto.getImportant() != null ? dto.getImportant() : false)
|
||||
.fichiersJoints(dto.getFichiersJoints())
|
||||
.build();
|
||||
|
||||
return message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Conversion entité vers ResponseDTO
|
||||
*/
|
||||
public MessageResponseDTO toResponseDTO(Message message) {
|
||||
if (message == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
MessageResponseDTO dto = MessageResponseDTO.builder()
|
||||
.id(message.getId())
|
||||
.sujet(message.getSujet())
|
||||
.contenu(message.getContenu())
|
||||
.type(message.getType())
|
||||
.priorite(message.getPriorite())
|
||||
.lu(message.getLu())
|
||||
.dateLecture(message.getDateLecture())
|
||||
.important(message.getImportant())
|
||||
.archive(message.getArchive())
|
||||
.dateArchivage(message.getDateArchivage())
|
||||
.fichiersJoints(message.getFichiersJoints())
|
||||
.dateCreation(message.getDateCreation())
|
||||
.dateModification(message.getDateModification())
|
||||
.actif(message.getActif())
|
||||
.build();
|
||||
|
||||
// Relations simplifiées
|
||||
if (message.getExpediteur() != null) {
|
||||
dto.setExpediteurId(message.getExpediteur().getId());
|
||||
dto.setExpediteurNom(message.getExpediteur().getNom());
|
||||
dto.setExpediteurPrenom(message.getExpediteur().getPrenom());
|
||||
dto.setExpediteurEmail(message.getExpediteur().getEmail());
|
||||
}
|
||||
|
||||
if (message.getDestinataire() != null) {
|
||||
dto.setDestinataireId(message.getDestinataire().getId());
|
||||
dto.setDestinataireNom(message.getDestinataire().getNom());
|
||||
dto.setDestinatairePrenom(message.getDestinataire().getPrenom());
|
||||
dto.setDestinataireEmail(message.getDestinataire().getEmail());
|
||||
}
|
||||
|
||||
if (message.getMessageParent() != null) {
|
||||
dto.setMessageParentId(message.getMessageParent().getId());
|
||||
}
|
||||
|
||||
if (message.getChantier() != null) {
|
||||
dto.setChantierId(message.getChantier().getId());
|
||||
dto.setChantierNom(message.getChantier().getNom());
|
||||
}
|
||||
|
||||
if (message.getEquipe() != null) {
|
||||
dto.setEquipeId(message.getEquipe().getId());
|
||||
dto.setEquipeNom(message.getEquipe().getNom());
|
||||
}
|
||||
|
||||
// Métadonnées calculées
|
||||
dto.setNombreReponses(message.getNombreReponses());
|
||||
dto.setEstReponse(message.estReponse());
|
||||
dto.setADesReponses(message.aDesReponses());
|
||||
dto.setEstCritique(message.estCritique());
|
||||
dto.setEstHautePriorite(message.estHautePriorite());
|
||||
dto.setEstRecent(message.estRecent());
|
||||
|
||||
return dto;
|
||||
}
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.mapper;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.Message;
|
||||
import dev.lions.btpxpress.domain.shared.dto.MessageCreateDTO;
|
||||
import dev.lions.btpxpress.domain.shared.dto.MessageResponseDTO;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
|
||||
/**
|
||||
* Mapper pour les messages - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@ApplicationScoped
|
||||
public class MessageMapper {
|
||||
|
||||
/**
|
||||
* Conversion DTO vers entité
|
||||
*/
|
||||
public Message toEntity(MessageCreateDTO dto) {
|
||||
if (dto == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Message message = Message.builder()
|
||||
.sujet(dto.getSujet())
|
||||
.contenu(dto.getContenu())
|
||||
.type(dto.getType() != null ? dto.getType() : dev.lions.btpxpress.domain.core.entity.TypeMessage.NORMAL)
|
||||
.priorite(dto.getPriorite() != null ? dto.getPriorite() : dev.lions.btpxpress.domain.core.entity.PrioriteMessage.NORMALE)
|
||||
.important(dto.getImportant() != null ? dto.getImportant() : false)
|
||||
.fichiersJoints(dto.getFichiersJoints())
|
||||
.build();
|
||||
|
||||
return message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Conversion entité vers ResponseDTO
|
||||
*/
|
||||
public MessageResponseDTO toResponseDTO(Message message) {
|
||||
if (message == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
MessageResponseDTO dto = MessageResponseDTO.builder()
|
||||
.id(message.getId())
|
||||
.sujet(message.getSujet())
|
||||
.contenu(message.getContenu())
|
||||
.type(message.getType())
|
||||
.priorite(message.getPriorite())
|
||||
.lu(message.getLu())
|
||||
.dateLecture(message.getDateLecture())
|
||||
.important(message.getImportant())
|
||||
.archive(message.getArchive())
|
||||
.dateArchivage(message.getDateArchivage())
|
||||
.fichiersJoints(message.getFichiersJoints())
|
||||
.dateCreation(message.getDateCreation())
|
||||
.dateModification(message.getDateModification())
|
||||
.actif(message.getActif())
|
||||
.build();
|
||||
|
||||
// Relations simplifiées
|
||||
if (message.getExpediteur() != null) {
|
||||
dto.setExpediteurId(message.getExpediteur().getId());
|
||||
dto.setExpediteurNom(message.getExpediteur().getNom());
|
||||
dto.setExpediteurPrenom(message.getExpediteur().getPrenom());
|
||||
dto.setExpediteurEmail(message.getExpediteur().getEmail());
|
||||
}
|
||||
|
||||
if (message.getDestinataire() != null) {
|
||||
dto.setDestinataireId(message.getDestinataire().getId());
|
||||
dto.setDestinataireNom(message.getDestinataire().getNom());
|
||||
dto.setDestinatairePrenom(message.getDestinataire().getPrenom());
|
||||
dto.setDestinataireEmail(message.getDestinataire().getEmail());
|
||||
}
|
||||
|
||||
if (message.getMessageParent() != null) {
|
||||
dto.setMessageParentId(message.getMessageParent().getId());
|
||||
}
|
||||
|
||||
if (message.getChantier() != null) {
|
||||
dto.setChantierId(message.getChantier().getId());
|
||||
dto.setChantierNom(message.getChantier().getNom());
|
||||
}
|
||||
|
||||
if (message.getEquipe() != null) {
|
||||
dto.setEquipeId(message.getEquipe().getId());
|
||||
dto.setEquipeNom(message.getEquipe().getNom());
|
||||
}
|
||||
|
||||
// Métadonnées calculées
|
||||
dto.setNombreReponses(message.getNombreReponses());
|
||||
dto.setEstReponse(message.estReponse());
|
||||
dto.setADesReponses(message.aDesReponses());
|
||||
dto.setEstCritique(message.estCritique());
|
||||
dto.setEstHautePriorite(message.estHautePriorite());
|
||||
dto.setEstRecent(message.estRecent());
|
||||
|
||||
return dto;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,99 +1,99 @@
|
||||
package dev.lions.btpxpress.domain.shared.mapper;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.Notification;
|
||||
import dev.lions.btpxpress.domain.shared.dto.NotificationCreateDTO;
|
||||
import dev.lions.btpxpress.domain.shared.dto.NotificationResponseDTO;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
|
||||
/**
|
||||
* Mapper pour les notifications - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@ApplicationScoped
|
||||
public class NotificationMapper {
|
||||
|
||||
/**
|
||||
* Conversion DTO vers entité
|
||||
*/
|
||||
public Notification toEntity(NotificationCreateDTO dto) {
|
||||
if (dto == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Notification notification = Notification.builder()
|
||||
.titre(dto.getTitre())
|
||||
.message(dto.getMessage())
|
||||
.type(dto.getType())
|
||||
.priorite(dto.getPriorite() != null ? dto.getPriorite() : dev.lions.btpxpress.domain.core.entity.PrioriteNotification.NORMALE)
|
||||
.lienAction(dto.getLienAction())
|
||||
.donnees(dto.getDonnees())
|
||||
.build();
|
||||
|
||||
return notification;
|
||||
}
|
||||
|
||||
/**
|
||||
* Conversion entité vers ResponseDTO
|
||||
*/
|
||||
public NotificationResponseDTO toResponseDTO(Notification notification) {
|
||||
if (notification == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
NotificationResponseDTO dto = NotificationResponseDTO.builder()
|
||||
.id(notification.getId())
|
||||
.titre(notification.getTitre())
|
||||
.message(notification.getMessage())
|
||||
.type(notification.getType())
|
||||
.priorite(notification.getPriorite())
|
||||
.lue(notification.getLue())
|
||||
.dateLecture(notification.getDateLecture())
|
||||
.lienAction(notification.getLienAction())
|
||||
.donnees(notification.getDonnees())
|
||||
.dateCreation(notification.getDateCreation())
|
||||
.dateModification(notification.getDateModification())
|
||||
.actif(notification.getActif())
|
||||
.build();
|
||||
|
||||
// Relations simplifiées
|
||||
if (notification.getUser() != null) {
|
||||
dto.setUserId(notification.getUser().getId());
|
||||
dto.setUserNom(notification.getUser().getNom());
|
||||
dto.setUserPrenom(notification.getUser().getPrenom());
|
||||
dto.setUserEmail(notification.getUser().getEmail());
|
||||
}
|
||||
|
||||
if (notification.getChantier() != null) {
|
||||
dto.setChantierId(notification.getChantier().getId());
|
||||
dto.setChantierNom(notification.getChantier().getNom());
|
||||
}
|
||||
|
||||
if (notification.getMateriel() != null) {
|
||||
dto.setMaterielId(notification.getMateriel().getId());
|
||||
dto.setMaterielNom(notification.getMateriel().getNom());
|
||||
}
|
||||
|
||||
if (notification.getMaintenance() != null) {
|
||||
dto.setMaintenanceId(notification.getMaintenance().getId());
|
||||
}
|
||||
|
||||
if (notification.getCreeePar() != null) {
|
||||
dto.setCreeeParId(notification.getCreeePar().getId());
|
||||
dto.setCreeeParNom(notification.getCreeePar().getNom());
|
||||
dto.setCreeeParEmail(notification.getCreeePar().getEmail());
|
||||
}
|
||||
|
||||
// Métadonnées calculées
|
||||
dto.setEstCritique(notification.estCritique());
|
||||
dto.setEstHautePriorite(notification.estHautePriorite());
|
||||
dto.setEstRecente(notification.estRecente());
|
||||
dto.setHasLienAction(notification.hasLienAction());
|
||||
dto.setHasDonnees(notification.hasDonnees());
|
||||
|
||||
return dto;
|
||||
}
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.mapper;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.Notification;
|
||||
import dev.lions.btpxpress.domain.shared.dto.NotificationCreateDTO;
|
||||
import dev.lions.btpxpress.domain.shared.dto.NotificationResponseDTO;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
|
||||
/**
|
||||
* Mapper pour les notifications - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@ApplicationScoped
|
||||
public class NotificationMapper {
|
||||
|
||||
/**
|
||||
* Conversion DTO vers entité
|
||||
*/
|
||||
public Notification toEntity(NotificationCreateDTO dto) {
|
||||
if (dto == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Notification notification = Notification.builder()
|
||||
.titre(dto.getTitre())
|
||||
.message(dto.getMessage())
|
||||
.type(dto.getType())
|
||||
.priorite(dto.getPriorite() != null ? dto.getPriorite() : dev.lions.btpxpress.domain.core.entity.PrioriteNotification.NORMALE)
|
||||
.lienAction(dto.getLienAction())
|
||||
.donnees(dto.getDonnees())
|
||||
.build();
|
||||
|
||||
return notification;
|
||||
}
|
||||
|
||||
/**
|
||||
* Conversion entité vers ResponseDTO
|
||||
*/
|
||||
public NotificationResponseDTO toResponseDTO(Notification notification) {
|
||||
if (notification == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
NotificationResponseDTO dto = NotificationResponseDTO.builder()
|
||||
.id(notification.getId())
|
||||
.titre(notification.getTitre())
|
||||
.message(notification.getMessage())
|
||||
.type(notification.getType())
|
||||
.priorite(notification.getPriorite())
|
||||
.lue(notification.getLue())
|
||||
.dateLecture(notification.getDateLecture())
|
||||
.lienAction(notification.getLienAction())
|
||||
.donnees(notification.getDonnees())
|
||||
.dateCreation(notification.getDateCreation())
|
||||
.dateModification(notification.getDateModification())
|
||||
.actif(notification.getActif())
|
||||
.build();
|
||||
|
||||
// Relations simplifiées
|
||||
if (notification.getUser() != null) {
|
||||
dto.setUserId(notification.getUser().getId());
|
||||
dto.setUserNom(notification.getUser().getNom());
|
||||
dto.setUserPrenom(notification.getUser().getPrenom());
|
||||
dto.setUserEmail(notification.getUser().getEmail());
|
||||
}
|
||||
|
||||
if (notification.getChantier() != null) {
|
||||
dto.setChantierId(notification.getChantier().getId());
|
||||
dto.setChantierNom(notification.getChantier().getNom());
|
||||
}
|
||||
|
||||
if (notification.getMateriel() != null) {
|
||||
dto.setMaterielId(notification.getMateriel().getId());
|
||||
dto.setMaterielNom(notification.getMateriel().getNom());
|
||||
}
|
||||
|
||||
if (notification.getMaintenance() != null) {
|
||||
dto.setMaintenanceId(notification.getMaintenance().getId());
|
||||
}
|
||||
|
||||
if (notification.getCreeePar() != null) {
|
||||
dto.setCreeeParId(notification.getCreeePar().getId());
|
||||
dto.setCreeeParNom(notification.getCreeePar().getNom());
|
||||
dto.setCreeeParEmail(notification.getCreeePar().getEmail());
|
||||
}
|
||||
|
||||
// Métadonnées calculées
|
||||
dto.setEstCritique(notification.estCritique());
|
||||
dto.setEstHautePriorite(notification.estHautePriorite());
|
||||
dto.setEstRecente(notification.estRecente());
|
||||
dto.setHasLienAction(notification.hasLienAction());
|
||||
dto.setHasDonnees(notification.hasDonnees());
|
||||
|
||||
return dto;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,146 +1,146 @@
|
||||
package dev.lions.btpxpress.domain.shared.mapper;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.PhaseChantier;
|
||||
import dev.lions.btpxpress.domain.shared.dto.PhaseChantierCreateDTO;
|
||||
import dev.lions.btpxpress.domain.shared.dto.PhaseChantierResponseDTO;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
|
||||
/**
|
||||
* Mapper pour les phases de chantier - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@ApplicationScoped
|
||||
public class PhaseChantierMapper {
|
||||
|
||||
/**
|
||||
* Conversion DTO vers entité
|
||||
*/
|
||||
public PhaseChantier toEntity(PhaseChantierCreateDTO dto) {
|
||||
if (dto == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
PhaseChantier phase = new PhaseChantier();
|
||||
phase.setNom(dto.getNom());
|
||||
phase.setDescription(dto.getDescription());
|
||||
phase.setType(dto.getType());
|
||||
phase.setOrdreExecution(dto.getOrdreExecution());
|
||||
phase.setDateDebutPrevue(dto.getDateDebutPrevue());
|
||||
phase.setDateFinPrevue(dto.getDateFinPrevue());
|
||||
phase.setBudgetPrevu(dto.getBudgetPrevu());
|
||||
phase.setEquipeResponsableNom(dto.getEquipeResponsableNom());
|
||||
phase.setChefEquipeNom(dto.getChefEquipeNom());
|
||||
phase.setDureePrevueJours(dto.getDureePrevueJours());
|
||||
phase.setPriorite(dto.getPriorite() != null ? dto.getPriorite() : dev.lions.btpxpress.domain.core.entity.PrioritePhase.NORMALE);
|
||||
phase.setPrerequis(dto.getPrerequis());
|
||||
phase.setLivrablesAttendus(dto.getLivrablesAttendus());
|
||||
phase.setCommentaires(dto.getCommentaires());
|
||||
phase.setRisquesIdentifies(dto.getRisquesIdentifies());
|
||||
phase.setMesuresSecurite(dto.getMesuresSecurite());
|
||||
phase.setMaterielRequis(dto.getMaterielRequis());
|
||||
phase.setCompetencesRequises(dto.getCompetencesRequises());
|
||||
phase.setBloquante(dto.getBloquante() != null ? dto.getBloquante() : false);
|
||||
phase.setFacturable(dto.getFacturable() != null ? dto.getFacturable() : true);
|
||||
phase.setCode(dto.getCode());
|
||||
phase.setCategorie(dto.getCategorie());
|
||||
phase.setObjectifs(dto.getObjectifs());
|
||||
|
||||
return phase;
|
||||
}
|
||||
|
||||
/**
|
||||
* Conversion entité vers ResponseDTO
|
||||
*/
|
||||
public PhaseChantierResponseDTO toResponseDTO(PhaseChantier phase) {
|
||||
if (phase == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
PhaseChantierResponseDTO dto = PhaseChantierResponseDTO.builder()
|
||||
.id(phase.getId())
|
||||
.nom(phase.getNom())
|
||||
.description(phase.getDescription())
|
||||
.statut(phase.getStatut())
|
||||
.type(phase.getType())
|
||||
.ordreExecution(phase.getOrdreExecution())
|
||||
.dateDebutPrevue(phase.getDateDebutPrevue())
|
||||
.dateFinPrevue(phase.getDateFinPrevue())
|
||||
.dateDebutReelle(phase.getDateDebutReelle())
|
||||
.dateFinReelle(phase.getDateFinReelle())
|
||||
.pourcentageAvancement(phase.getPourcentageAvancement())
|
||||
.budgetPrevu(phase.getBudgetPrevu())
|
||||
.coutReel(phase.getCoutReel())
|
||||
.equipeResponsableNom(phase.getEquipeResponsableNom())
|
||||
.chefEquipeNom(phase.getChefEquipeNom())
|
||||
.dureePrevueJours(phase.getDureePrevueJours())
|
||||
.dureeReelleJours(phase.getDureeReelleJours())
|
||||
.priorite(phase.getPriorite())
|
||||
.prerequis(phase.getPrerequis())
|
||||
.livrablesAttendus(phase.getLivrablesAttendus())
|
||||
.commentaires(phase.getCommentaires())
|
||||
.risquesIdentifies(phase.getRisquesIdentifies())
|
||||
.mesuresSecurite(phase.getMesuresSecurite())
|
||||
.materielRequis(phase.getMaterielRequis())
|
||||
.competencesRequises(phase.getCompetencesRequises())
|
||||
.bloquante(phase.getBloquante())
|
||||
.facturable(phase.getFacturable())
|
||||
.actif(phase.getActif())
|
||||
.code(phase.getCode())
|
||||
.categorie(phase.getCategorie())
|
||||
.objectifs(phase.getObjectifs())
|
||||
.dateCreation(phase.getDateCreation())
|
||||
.dateModification(phase.getDateModification())
|
||||
.creePar(phase.getCreePar())
|
||||
.modifiePar(phase.getModifiePar())
|
||||
.build();
|
||||
|
||||
// Relations simplifiées
|
||||
if (phase.getChantier() != null) {
|
||||
dto.setChantierId(phase.getChantier().getId());
|
||||
dto.setChantierNom(phase.getChantier().getNom());
|
||||
}
|
||||
|
||||
if (phase.getPhaseParent() != null) {
|
||||
dto.setPhaseParentId(phase.getPhaseParent().getId());
|
||||
dto.setPhaseParentNom(phase.getPhaseParent().getNom());
|
||||
}
|
||||
|
||||
// Compter les sous-phases
|
||||
if (phase.getSousPhases() != null) {
|
||||
dto.setNombreSousPhases(phase.getSousPhases().size());
|
||||
} else {
|
||||
dto.setNombreSousPhases(0);
|
||||
}
|
||||
|
||||
// Calculs
|
||||
// Note: Les méthodes isEnRetard, isEnCours, isTerminee ne sont pas directement disponibles
|
||||
// sur PhaseChantier, donc on les calcule ici si nécessaire
|
||||
dto.setEnRetard(false);
|
||||
dto.setEnCours(false);
|
||||
dto.setTerminee(false);
|
||||
|
||||
if (phase.getStatut() != null) {
|
||||
switch (phase.getStatut()) {
|
||||
case EN_COURS:
|
||||
dto.setEnCours(true);
|
||||
break;
|
||||
case TERMINEE:
|
||||
dto.setTerminee(true);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Vérifier si en retard (date fin prévue dépassée et pas terminée)
|
||||
if (phase.getDateFinPrevue() != null && !dto.getTerminee()) {
|
||||
dto.setEnRetard(java.time.LocalDate.now().isAfter(phase.getDateFinPrevue()));
|
||||
}
|
||||
|
||||
return dto;
|
||||
}
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.mapper;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.PhaseChantier;
|
||||
import dev.lions.btpxpress.domain.shared.dto.PhaseChantierCreateDTO;
|
||||
import dev.lions.btpxpress.domain.shared.dto.PhaseChantierResponseDTO;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
|
||||
/**
|
||||
* Mapper pour les phases de chantier - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@ApplicationScoped
|
||||
public class PhaseChantierMapper {
|
||||
|
||||
/**
|
||||
* Conversion DTO vers entité
|
||||
*/
|
||||
public PhaseChantier toEntity(PhaseChantierCreateDTO dto) {
|
||||
if (dto == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
PhaseChantier phase = new PhaseChantier();
|
||||
phase.setNom(dto.getNom());
|
||||
phase.setDescription(dto.getDescription());
|
||||
phase.setType(dto.getType());
|
||||
phase.setOrdreExecution(dto.getOrdreExecution());
|
||||
phase.setDateDebutPrevue(dto.getDateDebutPrevue());
|
||||
phase.setDateFinPrevue(dto.getDateFinPrevue());
|
||||
phase.setBudgetPrevu(dto.getBudgetPrevu());
|
||||
phase.setEquipeResponsableNom(dto.getEquipeResponsableNom());
|
||||
phase.setChefEquipeNom(dto.getChefEquipeNom());
|
||||
phase.setDureePrevueJours(dto.getDureePrevueJours());
|
||||
phase.setPriorite(dto.getPriorite() != null ? dto.getPriorite() : dev.lions.btpxpress.domain.core.entity.PrioritePhase.NORMALE);
|
||||
phase.setPrerequis(dto.getPrerequis());
|
||||
phase.setLivrablesAttendus(dto.getLivrablesAttendus());
|
||||
phase.setCommentaires(dto.getCommentaires());
|
||||
phase.setRisquesIdentifies(dto.getRisquesIdentifies());
|
||||
phase.setMesuresSecurite(dto.getMesuresSecurite());
|
||||
phase.setMaterielRequis(dto.getMaterielRequis());
|
||||
phase.setCompetencesRequises(dto.getCompetencesRequises());
|
||||
phase.setBloquante(dto.getBloquante() != null ? dto.getBloquante() : false);
|
||||
phase.setFacturable(dto.getFacturable() != null ? dto.getFacturable() : true);
|
||||
phase.setCode(dto.getCode());
|
||||
phase.setCategorie(dto.getCategorie());
|
||||
phase.setObjectifs(dto.getObjectifs());
|
||||
|
||||
return phase;
|
||||
}
|
||||
|
||||
/**
|
||||
* Conversion entité vers ResponseDTO
|
||||
*/
|
||||
public PhaseChantierResponseDTO toResponseDTO(PhaseChantier phase) {
|
||||
if (phase == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
PhaseChantierResponseDTO dto = PhaseChantierResponseDTO.builder()
|
||||
.id(phase.getId())
|
||||
.nom(phase.getNom())
|
||||
.description(phase.getDescription())
|
||||
.statut(phase.getStatut())
|
||||
.type(phase.getType())
|
||||
.ordreExecution(phase.getOrdreExecution())
|
||||
.dateDebutPrevue(phase.getDateDebutPrevue())
|
||||
.dateFinPrevue(phase.getDateFinPrevue())
|
||||
.dateDebutReelle(phase.getDateDebutReelle())
|
||||
.dateFinReelle(phase.getDateFinReelle())
|
||||
.pourcentageAvancement(phase.getPourcentageAvancement())
|
||||
.budgetPrevu(phase.getBudgetPrevu())
|
||||
.coutReel(phase.getCoutReel())
|
||||
.equipeResponsableNom(phase.getEquipeResponsableNom())
|
||||
.chefEquipeNom(phase.getChefEquipeNom())
|
||||
.dureePrevueJours(phase.getDureePrevueJours())
|
||||
.dureeReelleJours(phase.getDureeReelleJours())
|
||||
.priorite(phase.getPriorite())
|
||||
.prerequis(phase.getPrerequis())
|
||||
.livrablesAttendus(phase.getLivrablesAttendus())
|
||||
.commentaires(phase.getCommentaires())
|
||||
.risquesIdentifies(phase.getRisquesIdentifies())
|
||||
.mesuresSecurite(phase.getMesuresSecurite())
|
||||
.materielRequis(phase.getMaterielRequis())
|
||||
.competencesRequises(phase.getCompetencesRequises())
|
||||
.bloquante(phase.getBloquante())
|
||||
.facturable(phase.getFacturable())
|
||||
.actif(phase.getActif())
|
||||
.code(phase.getCode())
|
||||
.categorie(phase.getCategorie())
|
||||
.objectifs(phase.getObjectifs())
|
||||
.dateCreation(phase.getDateCreation())
|
||||
.dateModification(phase.getDateModification())
|
||||
.creePar(phase.getCreePar())
|
||||
.modifiePar(phase.getModifiePar())
|
||||
.build();
|
||||
|
||||
// Relations simplifiées
|
||||
if (phase.getChantier() != null) {
|
||||
dto.setChantierId(phase.getChantier().getId());
|
||||
dto.setChantierNom(phase.getChantier().getNom());
|
||||
}
|
||||
|
||||
if (phase.getPhaseParent() != null) {
|
||||
dto.setPhaseParentId(phase.getPhaseParent().getId());
|
||||
dto.setPhaseParentNom(phase.getPhaseParent().getNom());
|
||||
}
|
||||
|
||||
// Compter les sous-phases
|
||||
if (phase.getSousPhases() != null) {
|
||||
dto.setNombreSousPhases(phase.getSousPhases().size());
|
||||
} else {
|
||||
dto.setNombreSousPhases(0);
|
||||
}
|
||||
|
||||
// Calculs
|
||||
// Note: Les méthodes isEnRetard, isEnCours, isTerminee ne sont pas directement disponibles
|
||||
// sur PhaseChantier, donc on les calcule ici si nécessaire
|
||||
dto.setEnRetard(false);
|
||||
dto.setEnCours(false);
|
||||
dto.setTerminee(false);
|
||||
|
||||
if (phase.getStatut() != null) {
|
||||
switch (phase.getStatut()) {
|
||||
case EN_COURS:
|
||||
dto.setEnCours(true);
|
||||
break;
|
||||
case TERMINEE:
|
||||
dto.setTerminee(true);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Vérifier si en retard (date fin prévue dépassée et pas terminée)
|
||||
if (phase.getDateFinPrevue() != null && !dto.getTerminee()) {
|
||||
dto.setEnRetard(java.time.LocalDate.now().isAfter(phase.getDateFinPrevue()));
|
||||
}
|
||||
|
||||
return dto;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,108 +1,108 @@
|
||||
package dev.lions.btpxpress.domain.shared.mapper;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.PlanningEvent;
|
||||
import dev.lions.btpxpress.domain.shared.dto.PlanningEventCreateDTO;
|
||||
import dev.lions.btpxpress.domain.shared.dto.PlanningEventResponseDTO;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
import java.util.ArrayList;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Mapper pour les événements de planning - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@ApplicationScoped
|
||||
public class PlanningEventMapper {
|
||||
|
||||
/**
|
||||
* Conversion DTO vers entité
|
||||
*/
|
||||
public PlanningEvent toEntity(PlanningEventCreateDTO dto) {
|
||||
if (dto == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
PlanningEvent event = PlanningEvent.builder()
|
||||
.titre(dto.getTitre())
|
||||
.description(dto.getDescription())
|
||||
.dateDebut(dto.getDateDebut())
|
||||
.dateFin(dto.getDateFin())
|
||||
.type(dto.getType())
|
||||
.priorite(dto.getPriorite() != null ? dto.getPriorite() : dev.lions.btpxpress.domain.core.entity.PrioritePlanningEvent.NORMALE)
|
||||
.notes(dto.getNotes())
|
||||
.couleur(dto.getCouleur())
|
||||
.build();
|
||||
|
||||
return event;
|
||||
}
|
||||
|
||||
/**
|
||||
* Conversion entité vers ResponseDTO
|
||||
*/
|
||||
public PlanningEventResponseDTO toResponseDTO(PlanningEvent event) {
|
||||
if (event == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
PlanningEventResponseDTO dto = PlanningEventResponseDTO.builder()
|
||||
.id(event.getId())
|
||||
.titre(event.getTitre())
|
||||
.description(event.getDescription())
|
||||
.dateDebut(event.getDateDebut())
|
||||
.dateFin(event.getDateFin())
|
||||
.type(event.getType())
|
||||
.statut(event.getStatut())
|
||||
.priorite(event.getPriorite())
|
||||
.notes(event.getNotes())
|
||||
.couleur(event.getCouleur())
|
||||
.dateCreation(event.getDateCreation())
|
||||
.dateModification(event.getDateModification())
|
||||
.actif(event.getActif())
|
||||
.build();
|
||||
|
||||
// Relations simplifiées
|
||||
if (event.getChantier() != null) {
|
||||
dto.setChantierId(event.getChantier().getId());
|
||||
dto.setChantierNom(event.getChantier().getNom());
|
||||
}
|
||||
|
||||
if (event.getEquipe() != null) {
|
||||
dto.setEquipeId(event.getEquipe().getId());
|
||||
dto.setEquipeNom(event.getEquipe().getNom());
|
||||
}
|
||||
|
||||
// Employés
|
||||
if (event.getEmployes() != null) {
|
||||
dto.setEmployeIds(event.getEmployes().stream()
|
||||
.map(emp -> emp.getId())
|
||||
.collect(Collectors.toList()));
|
||||
dto.setNombreEmployes(event.getEmployes().size());
|
||||
} else {
|
||||
dto.setEmployeIds(new ArrayList<>());
|
||||
dto.setNombreEmployes(0);
|
||||
}
|
||||
|
||||
// Matériels
|
||||
if (event.getMateriels() != null) {
|
||||
dto.setMaterielIds(event.getMateriels().stream()
|
||||
.map(mat -> mat.getId())
|
||||
.collect(Collectors.toList()));
|
||||
dto.setNombreMateriels(event.getMateriels().size());
|
||||
} else {
|
||||
dto.setMaterielIds(new ArrayList<>());
|
||||
dto.setNombreMateriels(0);
|
||||
}
|
||||
|
||||
// Métadonnées calculées
|
||||
dto.setDureeEnHeures(event.getDureeEnHeures());
|
||||
dto.setEnCours(event.isEnCours());
|
||||
dto.setTermine(event.isTermine());
|
||||
dto.setEnRetard(event.isEnRetard());
|
||||
|
||||
return dto;
|
||||
}
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.mapper;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.PlanningEvent;
|
||||
import dev.lions.btpxpress.domain.shared.dto.PlanningEventCreateDTO;
|
||||
import dev.lions.btpxpress.domain.shared.dto.PlanningEventResponseDTO;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
import java.util.ArrayList;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Mapper pour les événements de planning - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@ApplicationScoped
|
||||
public class PlanningEventMapper {
|
||||
|
||||
/**
|
||||
* Conversion DTO vers entité
|
||||
*/
|
||||
public PlanningEvent toEntity(PlanningEventCreateDTO dto) {
|
||||
if (dto == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
PlanningEvent event = PlanningEvent.builder()
|
||||
.titre(dto.getTitre())
|
||||
.description(dto.getDescription())
|
||||
.dateDebut(dto.getDateDebut())
|
||||
.dateFin(dto.getDateFin())
|
||||
.type(dto.getType())
|
||||
.priorite(dto.getPriorite() != null ? dto.getPriorite() : dev.lions.btpxpress.domain.core.entity.PrioritePlanningEvent.NORMALE)
|
||||
.notes(dto.getNotes())
|
||||
.couleur(dto.getCouleur())
|
||||
.build();
|
||||
|
||||
return event;
|
||||
}
|
||||
|
||||
/**
|
||||
* Conversion entité vers ResponseDTO
|
||||
*/
|
||||
public PlanningEventResponseDTO toResponseDTO(PlanningEvent event) {
|
||||
if (event == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
PlanningEventResponseDTO dto = PlanningEventResponseDTO.builder()
|
||||
.id(event.getId())
|
||||
.titre(event.getTitre())
|
||||
.description(event.getDescription())
|
||||
.dateDebut(event.getDateDebut())
|
||||
.dateFin(event.getDateFin())
|
||||
.type(event.getType())
|
||||
.statut(event.getStatut())
|
||||
.priorite(event.getPriorite())
|
||||
.notes(event.getNotes())
|
||||
.couleur(event.getCouleur())
|
||||
.dateCreation(event.getDateCreation())
|
||||
.dateModification(event.getDateModification())
|
||||
.actif(event.getActif())
|
||||
.build();
|
||||
|
||||
// Relations simplifiées
|
||||
if (event.getChantier() != null) {
|
||||
dto.setChantierId(event.getChantier().getId());
|
||||
dto.setChantierNom(event.getChantier().getNom());
|
||||
}
|
||||
|
||||
if (event.getEquipe() != null) {
|
||||
dto.setEquipeId(event.getEquipe().getId());
|
||||
dto.setEquipeNom(event.getEquipe().getNom());
|
||||
}
|
||||
|
||||
// Employés
|
||||
if (event.getEmployes() != null) {
|
||||
dto.setEmployeIds(event.getEmployes().stream()
|
||||
.map(emp -> emp.getId())
|
||||
.collect(Collectors.toList()));
|
||||
dto.setNombreEmployes(event.getEmployes().size());
|
||||
} else {
|
||||
dto.setEmployeIds(new ArrayList<>());
|
||||
dto.setNombreEmployes(0);
|
||||
}
|
||||
|
||||
// Matériels
|
||||
if (event.getMateriels() != null) {
|
||||
dto.setMaterielIds(event.getMateriels().stream()
|
||||
.map(mat -> mat.getId())
|
||||
.collect(Collectors.toList()));
|
||||
dto.setNombreMateriels(event.getMateriels().size());
|
||||
} else {
|
||||
dto.setMaterielIds(new ArrayList<>());
|
||||
dto.setNombreMateriels(0);
|
||||
}
|
||||
|
||||
// Métadonnées calculées
|
||||
dto.setDureeEnHeures(event.getDureeEnHeures());
|
||||
dto.setEnCours(event.isEnCours());
|
||||
dto.setTermine(event.isTermine());
|
||||
dto.setEnRetard(event.isEnRetard());
|
||||
|
||||
return dto;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,126 +1,126 @@
|
||||
package dev.lions.btpxpress.domain.shared.mapper;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.PlanningMateriel;
|
||||
import dev.lions.btpxpress.domain.shared.dto.PlanningMaterielCreateDTO;
|
||||
import dev.lions.btpxpress.domain.shared.dto.PlanningMaterielResponseDTO;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
|
||||
/**
|
||||
* Mapper pour les plannings de matériel - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@ApplicationScoped
|
||||
public class PlanningMaterielMapper {
|
||||
|
||||
/**
|
||||
* Conversion DTO vers entité
|
||||
*/
|
||||
public PlanningMateriel toEntity(PlanningMaterielCreateDTO dto) {
|
||||
if (dto == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
PlanningMateriel planning = PlanningMateriel.builder()
|
||||
.nomPlanning(dto.getNomPlanning())
|
||||
.descriptionPlanning(dto.getDescriptionPlanning())
|
||||
.dateDebut(dto.getDateDebut())
|
||||
.dateFin(dto.getDateFin())
|
||||
.typePlanning(dto.getTypePlanning())
|
||||
.statutPlanning(dto.getStatutPlanning() != null ? dto.getStatutPlanning() : dev.lions.btpxpress.domain.core.entity.StatutPlanning.BROUILLON)
|
||||
.versionPlanning(dto.getVersionPlanning() != null ? dto.getVersionPlanning() : 1)
|
||||
.planningParentId(dto.getPlanningParentId())
|
||||
.planificateur(dto.getPlanificateur())
|
||||
.valideur(dto.getValideur())
|
||||
.commentairesValidation(dto.getCommentairesValidation())
|
||||
.conflitsDetectes(dto.getConflitsDetectes() != null ? dto.getConflitsDetectes() : false)
|
||||
.nombreConflits(dto.getNombreConflits() != null ? dto.getNombreConflits() : 0)
|
||||
.resolutionConflitsAuto(dto.getResolutionConflitsAuto() != null ? dto.getResolutionConflitsAuto() : false)
|
||||
.tauxUtilisationPrevu(dto.getTauxUtilisationPrevu())
|
||||
.scoreOptimisation(dto.getScoreOptimisation())
|
||||
.optimiseAutomatiquement(dto.getOptimiseAutomatiquement() != null ? dto.getOptimiseAutomatiquement() : false)
|
||||
.notificationsActivees(dto.getNotificationsActivees() != null ? dto.getNotificationsActivees() : true)
|
||||
.alerteConflits(dto.getAlerteConflits() != null ? dto.getAlerteConflits() : true)
|
||||
.alerteSurcharge(dto.getAlerteSurcharge() != null ? dto.getAlerteSurcharge() : true)
|
||||
.seuilAlerteUtilisation(dto.getSeuilAlerteUtilisation() != null ? dto.getSeuilAlerteUtilisation() : 85.0)
|
||||
.couleurPlanning(dto.getCouleurPlanning())
|
||||
.vueParDefaut(dto.getVueParDefaut() != null ? dto.getVueParDefaut() : dev.lions.btpxpress.domain.core.entity.VuePlanning.GANTT)
|
||||
.granulariteAffichage(dto.getGranulariteAffichage() != null ? dto.getGranulariteAffichage() : "JOUR")
|
||||
.optionsAffichage(dto.getOptionsAffichage())
|
||||
.reglesPlanification(dto.getReglesPlanification())
|
||||
.build();
|
||||
|
||||
return planning;
|
||||
}
|
||||
|
||||
/**
|
||||
* Conversion entité vers ResponseDTO
|
||||
*/
|
||||
public PlanningMaterielResponseDTO toResponseDTO(PlanningMateriel planning) {
|
||||
if (planning == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
PlanningMaterielResponseDTO dto = PlanningMaterielResponseDTO.builder()
|
||||
.id(planning.getId())
|
||||
.nomPlanning(planning.getNomPlanning())
|
||||
.descriptionPlanning(planning.getDescriptionPlanning())
|
||||
.dateDebut(planning.getDateDebut())
|
||||
.dateFin(planning.getDateFin())
|
||||
.typePlanning(planning.getTypePlanning())
|
||||
.statutPlanning(planning.getStatutPlanning())
|
||||
.versionPlanning(planning.getVersionPlanning())
|
||||
.planningParentId(planning.getPlanningParentId())
|
||||
.planificateur(planning.getPlanificateur())
|
||||
.valideur(planning.getValideur())
|
||||
.dateValidation(planning.getDateValidation())
|
||||
.commentairesValidation(planning.getCommentairesValidation())
|
||||
.conflitsDetectes(planning.getConflitsDetectes())
|
||||
.nombreConflits(planning.getNombreConflits())
|
||||
.derniereVerificationConflits(planning.getDerniereVerificationConflits())
|
||||
.resolutionConflitsAuto(planning.getResolutionConflitsAuto())
|
||||
.tauxUtilisationPrevu(planning.getTauxUtilisationPrevu())
|
||||
.scoreOptimisation(planning.getScoreOptimisation())
|
||||
.optimiseAutomatiquement(planning.getOptimiseAutomatiquement())
|
||||
.derniereOptimisation(planning.getDerniereOptimisation())
|
||||
.notificationsActivees(planning.getNotificationsActivees())
|
||||
.alerteConflits(planning.getAlerteConflits())
|
||||
.alerteSurcharge(planning.getAlerteSurcharge())
|
||||
.seuilAlerteUtilisation(planning.getSeuilAlerteUtilisation())
|
||||
.couleurPlanning(planning.getCouleurPlanning())
|
||||
.vueParDefaut(planning.getVueParDefaut())
|
||||
.granulariteAffichage(planning.getGranulariteAffichage())
|
||||
.optionsAffichage(planning.getOptionsAffichage())
|
||||
.reglesPlanification(planning.getReglesPlanification())
|
||||
.dateCreation(planning.getDateCreation())
|
||||
.dateModification(planning.getDateModification())
|
||||
.creePar(planning.getCreePar())
|
||||
.modifiePar(planning.getModifiePar())
|
||||
.actif(planning.getActif())
|
||||
.build();
|
||||
|
||||
// Relations simplifiées
|
||||
if (planning.getMateriel() != null) {
|
||||
dto.setMaterielId(planning.getMateriel().getId());
|
||||
dto.setMaterielNom(planning.getMateriel().getNom());
|
||||
}
|
||||
|
||||
if (planning.getReservations() != null) {
|
||||
dto.setNombreReservations(planning.getReservations().size());
|
||||
}
|
||||
|
||||
// Métadonnées calculées
|
||||
dto.setDureePlanningJours(planning.getDureePlanningJours());
|
||||
dto.setEstValide(planning.estValide());
|
||||
dto.setPeutEtreModifie(planning.peutEtreModifie());
|
||||
dto.setNecessiteAttention(planning.necessiteAttention());
|
||||
dto.setCouleurAffichage(planning.getCouleurAffichage());
|
||||
dto.setIconeTypePlanning(planning.getIconeTypePlanning());
|
||||
dto.setPourcentageAvancement(planning.getPourcentageAvancement());
|
||||
|
||||
return dto;
|
||||
}
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.mapper;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.PlanningMateriel;
|
||||
import dev.lions.btpxpress.domain.shared.dto.PlanningMaterielCreateDTO;
|
||||
import dev.lions.btpxpress.domain.shared.dto.PlanningMaterielResponseDTO;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
|
||||
/**
|
||||
* Mapper pour les plannings de matériel - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@ApplicationScoped
|
||||
public class PlanningMaterielMapper {
|
||||
|
||||
/**
|
||||
* Conversion DTO vers entité
|
||||
*/
|
||||
public PlanningMateriel toEntity(PlanningMaterielCreateDTO dto) {
|
||||
if (dto == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
PlanningMateriel planning = PlanningMateriel.builder()
|
||||
.nomPlanning(dto.getNomPlanning())
|
||||
.descriptionPlanning(dto.getDescriptionPlanning())
|
||||
.dateDebut(dto.getDateDebut())
|
||||
.dateFin(dto.getDateFin())
|
||||
.typePlanning(dto.getTypePlanning())
|
||||
.statutPlanning(dto.getStatutPlanning() != null ? dto.getStatutPlanning() : dev.lions.btpxpress.domain.core.entity.StatutPlanning.BROUILLON)
|
||||
.versionPlanning(dto.getVersionPlanning() != null ? dto.getVersionPlanning() : 1)
|
||||
.planningParentId(dto.getPlanningParentId())
|
||||
.planificateur(dto.getPlanificateur())
|
||||
.valideur(dto.getValideur())
|
||||
.commentairesValidation(dto.getCommentairesValidation())
|
||||
.conflitsDetectes(dto.getConflitsDetectes() != null ? dto.getConflitsDetectes() : false)
|
||||
.nombreConflits(dto.getNombreConflits() != null ? dto.getNombreConflits() : 0)
|
||||
.resolutionConflitsAuto(dto.getResolutionConflitsAuto() != null ? dto.getResolutionConflitsAuto() : false)
|
||||
.tauxUtilisationPrevu(dto.getTauxUtilisationPrevu())
|
||||
.scoreOptimisation(dto.getScoreOptimisation())
|
||||
.optimiseAutomatiquement(dto.getOptimiseAutomatiquement() != null ? dto.getOptimiseAutomatiquement() : false)
|
||||
.notificationsActivees(dto.getNotificationsActivees() != null ? dto.getNotificationsActivees() : true)
|
||||
.alerteConflits(dto.getAlerteConflits() != null ? dto.getAlerteConflits() : true)
|
||||
.alerteSurcharge(dto.getAlerteSurcharge() != null ? dto.getAlerteSurcharge() : true)
|
||||
.seuilAlerteUtilisation(dto.getSeuilAlerteUtilisation() != null ? dto.getSeuilAlerteUtilisation() : 85.0)
|
||||
.couleurPlanning(dto.getCouleurPlanning())
|
||||
.vueParDefaut(dto.getVueParDefaut() != null ? dto.getVueParDefaut() : dev.lions.btpxpress.domain.core.entity.VuePlanning.GANTT)
|
||||
.granulariteAffichage(dto.getGranulariteAffichage() != null ? dto.getGranulariteAffichage() : "JOUR")
|
||||
.optionsAffichage(dto.getOptionsAffichage())
|
||||
.reglesPlanification(dto.getReglesPlanification())
|
||||
.build();
|
||||
|
||||
return planning;
|
||||
}
|
||||
|
||||
/**
|
||||
* Conversion entité vers ResponseDTO
|
||||
*/
|
||||
public PlanningMaterielResponseDTO toResponseDTO(PlanningMateriel planning) {
|
||||
if (planning == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
PlanningMaterielResponseDTO dto = PlanningMaterielResponseDTO.builder()
|
||||
.id(planning.getId())
|
||||
.nomPlanning(planning.getNomPlanning())
|
||||
.descriptionPlanning(planning.getDescriptionPlanning())
|
||||
.dateDebut(planning.getDateDebut())
|
||||
.dateFin(planning.getDateFin())
|
||||
.typePlanning(planning.getTypePlanning())
|
||||
.statutPlanning(planning.getStatutPlanning())
|
||||
.versionPlanning(planning.getVersionPlanning())
|
||||
.planningParentId(planning.getPlanningParentId())
|
||||
.planificateur(planning.getPlanificateur())
|
||||
.valideur(planning.getValideur())
|
||||
.dateValidation(planning.getDateValidation())
|
||||
.commentairesValidation(planning.getCommentairesValidation())
|
||||
.conflitsDetectes(planning.getConflitsDetectes())
|
||||
.nombreConflits(planning.getNombreConflits())
|
||||
.derniereVerificationConflits(planning.getDerniereVerificationConflits())
|
||||
.resolutionConflitsAuto(planning.getResolutionConflitsAuto())
|
||||
.tauxUtilisationPrevu(planning.getTauxUtilisationPrevu())
|
||||
.scoreOptimisation(planning.getScoreOptimisation())
|
||||
.optimiseAutomatiquement(planning.getOptimiseAutomatiquement())
|
||||
.derniereOptimisation(planning.getDerniereOptimisation())
|
||||
.notificationsActivees(planning.getNotificationsActivees())
|
||||
.alerteConflits(planning.getAlerteConflits())
|
||||
.alerteSurcharge(planning.getAlerteSurcharge())
|
||||
.seuilAlerteUtilisation(planning.getSeuilAlerteUtilisation())
|
||||
.couleurPlanning(planning.getCouleurPlanning())
|
||||
.vueParDefaut(planning.getVueParDefaut())
|
||||
.granulariteAffichage(planning.getGranulariteAffichage())
|
||||
.optionsAffichage(planning.getOptionsAffichage())
|
||||
.reglesPlanification(planning.getReglesPlanification())
|
||||
.dateCreation(planning.getDateCreation())
|
||||
.dateModification(planning.getDateModification())
|
||||
.creePar(planning.getCreePar())
|
||||
.modifiePar(planning.getModifiePar())
|
||||
.actif(planning.getActif())
|
||||
.build();
|
||||
|
||||
// Relations simplifiées
|
||||
if (planning.getMateriel() != null) {
|
||||
dto.setMaterielId(planning.getMateriel().getId());
|
||||
dto.setMaterielNom(planning.getMateriel().getNom());
|
||||
}
|
||||
|
||||
if (planning.getReservations() != null) {
|
||||
dto.setNombreReservations(planning.getReservations().size());
|
||||
}
|
||||
|
||||
// Métadonnées calculées
|
||||
dto.setDureePlanningJours(planning.getDureePlanningJours());
|
||||
dto.setEstValide(planning.estValide());
|
||||
dto.setPeutEtreModifie(planning.peutEtreModifie());
|
||||
dto.setNecessiteAttention(planning.necessiteAttention());
|
||||
dto.setCouleurAffichage(planning.getCouleurAffichage());
|
||||
dto.setIconeTypePlanning(planning.getIconeTypePlanning());
|
||||
dto.setPourcentageAvancement(planning.getPourcentageAvancement());
|
||||
|
||||
return dto;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,130 +1,130 @@
|
||||
package dev.lions.btpxpress.domain.shared.mapper;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.ReservationMateriel;
|
||||
import dev.lions.btpxpress.domain.shared.dto.ReservationMaterielCreateDTO;
|
||||
import dev.lions.btpxpress.domain.shared.dto.ReservationMaterielResponseDTO;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
|
||||
/**
|
||||
* Mapper pour les réservations de matériel - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@ApplicationScoped
|
||||
public class ReservationMaterielMapper {
|
||||
|
||||
/**
|
||||
* Conversion DTO vers entité
|
||||
*/
|
||||
public ReservationMateriel toEntity(ReservationMaterielCreateDTO dto) {
|
||||
if (dto == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
ReservationMateriel reservation = ReservationMateriel.builder()
|
||||
.dateDebut(dto.getDateDebut())
|
||||
.dateFin(dto.getDateFin())
|
||||
.heureDebut(dto.getHeureDebut())
|
||||
.heureFin(dto.getHeureFin())
|
||||
.quantite(dto.getQuantite())
|
||||
.unite(dto.getUnite())
|
||||
.prixUnitairePrevisionnel(dto.getPrixUnitairePrevisionnel())
|
||||
.prixTotalPrevisionnel(dto.getPrixTotalPrevisionnel())
|
||||
.statut(dto.getStatut() != null ? dto.getStatut() : dev.lions.btpxpress.domain.core.entity.StatutReservationMateriel.PLANIFIEE)
|
||||
.priorite(dto.getPriorite() != null ? dto.getPriorite() : dev.lions.btpxpress.domain.core.entity.PrioriteReservation.NORMALE)
|
||||
.lieuLivraison(dto.getLieuLivraison())
|
||||
.instructionsLivraison(dto.getInstructionsLivraison())
|
||||
.responsableReception(dto.getResponsableReception())
|
||||
.telephoneContact(dto.getTelephoneContact())
|
||||
.dateLivraisonPrevue(dto.getDateLivraisonPrevue())
|
||||
.dateRetourPrevue(dto.getDateRetourPrevue())
|
||||
.demandeur(dto.getDemandeur())
|
||||
.valideur(dto.getValideur())
|
||||
.build();
|
||||
|
||||
return reservation;
|
||||
}
|
||||
|
||||
/**
|
||||
* Conversion entité vers ResponseDTO
|
||||
*/
|
||||
public ReservationMaterielResponseDTO toResponseDTO(ReservationMateriel reservation) {
|
||||
if (reservation == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
ReservationMaterielResponseDTO dto = ReservationMaterielResponseDTO.builder()
|
||||
.id(reservation.getId())
|
||||
.dateDebut(reservation.getDateDebut())
|
||||
.dateFin(reservation.getDateFin())
|
||||
.heureDebut(reservation.getHeureDebut())
|
||||
.heureFin(reservation.getHeureFin())
|
||||
.quantite(reservation.getQuantite())
|
||||
.unite(reservation.getUnite())
|
||||
.prixUnitairePrevisionnel(reservation.getPrixUnitairePrevisionnel())
|
||||
.prixTotalPrevisionnel(reservation.getPrixTotalPrevisionnel())
|
||||
.prixUnitaireReel(reservation.getPrixUnitaireReel())
|
||||
.prixTotalReel(reservation.getPrixTotalReel())
|
||||
.statut(reservation.getStatut())
|
||||
.priorite(reservation.getPriorite())
|
||||
.referenceReservation(reservation.getReferenceReservation())
|
||||
.lieuLivraison(reservation.getLieuLivraison())
|
||||
.instructionsLivraison(reservation.getInstructionsLivraison())
|
||||
.responsableReception(reservation.getResponsableReception())
|
||||
.telephoneContact(reservation.getTelephoneContact())
|
||||
.dateLivraisonPrevue(reservation.getDateLivraisonPrevue())
|
||||
.dateLivraisonReelle(reservation.getDateLivraisonReelle())
|
||||
.dateRetourPrevue(reservation.getDateRetourPrevue())
|
||||
.dateRetourReelle(reservation.getDateRetourReelle())
|
||||
.observationsLivraison(reservation.getObservationsLivraison())
|
||||
.observationsRetour(reservation.getObservationsRetour())
|
||||
.etatMaterielLivraison(reservation.getEtatMaterielLivraison())
|
||||
.etatMaterielRetour(reservation.getEtatMaterielRetour())
|
||||
.kilometrageDebut(reservation.getKilometrageDebut())
|
||||
.kilometrageFin(reservation.getKilometrageFin())
|
||||
.demandeur(reservation.getDemandeur())
|
||||
.valideur(reservation.getValideur())
|
||||
.dateValidation(reservation.getDateValidation())
|
||||
.motifRefus(reservation.getMotifRefus())
|
||||
.numeroFactureFournisseur(reservation.getNumeroFactureFournisseur())
|
||||
.dateFactureFournisseur(reservation.getDateFactureFournisseur())
|
||||
.factureTraitee(reservation.getFactureTraitee())
|
||||
.dateCreation(reservation.getDateCreation())
|
||||
.dateModification(reservation.getDateModification())
|
||||
.creePar(reservation.getCreePar())
|
||||
.modifiePar(reservation.getModifiePar())
|
||||
.actif(reservation.getActif())
|
||||
.build();
|
||||
|
||||
// Relations simplifiées
|
||||
if (reservation.getMateriel() != null) {
|
||||
dto.setMaterielId(reservation.getMateriel().getId());
|
||||
dto.setMaterielNom(reservation.getMateriel().getNom());
|
||||
// Note: Materiel n'a pas de getReference(), utiliser getNom() ou autre champ disponible
|
||||
}
|
||||
|
||||
if (reservation.getChantier() != null) {
|
||||
dto.setChantierId(reservation.getChantier().getId());
|
||||
dto.setChantierNom(reservation.getChantier().getNom());
|
||||
}
|
||||
|
||||
if (reservation.getPhase() != null) {
|
||||
dto.setPhaseId(reservation.getPhase().getId());
|
||||
dto.setPhaseNom(reservation.getPhase().getNom());
|
||||
}
|
||||
|
||||
if (reservation.getPlanningMateriel() != null) {
|
||||
dto.setPlanningMaterielId(reservation.getPlanningMateriel().getId());
|
||||
}
|
||||
|
||||
// Métadonnées calculées
|
||||
dto.setDureeReservationJours(reservation.getDureeReservationJours());
|
||||
dto.setEstEnCours(reservation.estEnCours());
|
||||
dto.setEstEnRetard(reservation.estEnRetard());
|
||||
|
||||
return dto;
|
||||
}
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.mapper;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.ReservationMateriel;
|
||||
import dev.lions.btpxpress.domain.shared.dto.ReservationMaterielCreateDTO;
|
||||
import dev.lions.btpxpress.domain.shared.dto.ReservationMaterielResponseDTO;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
|
||||
/**
|
||||
* Mapper pour les réservations de matériel - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@ApplicationScoped
|
||||
public class ReservationMaterielMapper {
|
||||
|
||||
/**
|
||||
* Conversion DTO vers entité
|
||||
*/
|
||||
public ReservationMateriel toEntity(ReservationMaterielCreateDTO dto) {
|
||||
if (dto == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
ReservationMateriel reservation = ReservationMateriel.builder()
|
||||
.dateDebut(dto.getDateDebut())
|
||||
.dateFin(dto.getDateFin())
|
||||
.heureDebut(dto.getHeureDebut())
|
||||
.heureFin(dto.getHeureFin())
|
||||
.quantite(dto.getQuantite())
|
||||
.unite(dto.getUnite())
|
||||
.prixUnitairePrevisionnel(dto.getPrixUnitairePrevisionnel())
|
||||
.prixTotalPrevisionnel(dto.getPrixTotalPrevisionnel())
|
||||
.statut(dto.getStatut() != null ? dto.getStatut() : dev.lions.btpxpress.domain.core.entity.StatutReservationMateriel.PLANIFIEE)
|
||||
.priorite(dto.getPriorite() != null ? dto.getPriorite() : dev.lions.btpxpress.domain.core.entity.PrioriteReservation.NORMALE)
|
||||
.lieuLivraison(dto.getLieuLivraison())
|
||||
.instructionsLivraison(dto.getInstructionsLivraison())
|
||||
.responsableReception(dto.getResponsableReception())
|
||||
.telephoneContact(dto.getTelephoneContact())
|
||||
.dateLivraisonPrevue(dto.getDateLivraisonPrevue())
|
||||
.dateRetourPrevue(dto.getDateRetourPrevue())
|
||||
.demandeur(dto.getDemandeur())
|
||||
.valideur(dto.getValideur())
|
||||
.build();
|
||||
|
||||
return reservation;
|
||||
}
|
||||
|
||||
/**
|
||||
* Conversion entité vers ResponseDTO
|
||||
*/
|
||||
public ReservationMaterielResponseDTO toResponseDTO(ReservationMateriel reservation) {
|
||||
if (reservation == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
ReservationMaterielResponseDTO dto = ReservationMaterielResponseDTO.builder()
|
||||
.id(reservation.getId())
|
||||
.dateDebut(reservation.getDateDebut())
|
||||
.dateFin(reservation.getDateFin())
|
||||
.heureDebut(reservation.getHeureDebut())
|
||||
.heureFin(reservation.getHeureFin())
|
||||
.quantite(reservation.getQuantite())
|
||||
.unite(reservation.getUnite())
|
||||
.prixUnitairePrevisionnel(reservation.getPrixUnitairePrevisionnel())
|
||||
.prixTotalPrevisionnel(reservation.getPrixTotalPrevisionnel())
|
||||
.prixUnitaireReel(reservation.getPrixUnitaireReel())
|
||||
.prixTotalReel(reservation.getPrixTotalReel())
|
||||
.statut(reservation.getStatut())
|
||||
.priorite(reservation.getPriorite())
|
||||
.referenceReservation(reservation.getReferenceReservation())
|
||||
.lieuLivraison(reservation.getLieuLivraison())
|
||||
.instructionsLivraison(reservation.getInstructionsLivraison())
|
||||
.responsableReception(reservation.getResponsableReception())
|
||||
.telephoneContact(reservation.getTelephoneContact())
|
||||
.dateLivraisonPrevue(reservation.getDateLivraisonPrevue())
|
||||
.dateLivraisonReelle(reservation.getDateLivraisonReelle())
|
||||
.dateRetourPrevue(reservation.getDateRetourPrevue())
|
||||
.dateRetourReelle(reservation.getDateRetourReelle())
|
||||
.observationsLivraison(reservation.getObservationsLivraison())
|
||||
.observationsRetour(reservation.getObservationsRetour())
|
||||
.etatMaterielLivraison(reservation.getEtatMaterielLivraison())
|
||||
.etatMaterielRetour(reservation.getEtatMaterielRetour())
|
||||
.kilometrageDebut(reservation.getKilometrageDebut())
|
||||
.kilometrageFin(reservation.getKilometrageFin())
|
||||
.demandeur(reservation.getDemandeur())
|
||||
.valideur(reservation.getValideur())
|
||||
.dateValidation(reservation.getDateValidation())
|
||||
.motifRefus(reservation.getMotifRefus())
|
||||
.numeroFactureFournisseur(reservation.getNumeroFactureFournisseur())
|
||||
.dateFactureFournisseur(reservation.getDateFactureFournisseur())
|
||||
.factureTraitee(reservation.getFactureTraitee())
|
||||
.dateCreation(reservation.getDateCreation())
|
||||
.dateModification(reservation.getDateModification())
|
||||
.creePar(reservation.getCreePar())
|
||||
.modifiePar(reservation.getModifiePar())
|
||||
.actif(reservation.getActif())
|
||||
.build();
|
||||
|
||||
// Relations simplifiées
|
||||
if (reservation.getMateriel() != null) {
|
||||
dto.setMaterielId(reservation.getMateriel().getId());
|
||||
dto.setMaterielNom(reservation.getMateriel().getNom());
|
||||
// Note: Materiel n'a pas de getReference(), utiliser getNom() ou autre champ disponible
|
||||
}
|
||||
|
||||
if (reservation.getChantier() != null) {
|
||||
dto.setChantierId(reservation.getChantier().getId());
|
||||
dto.setChantierNom(reservation.getChantier().getNom());
|
||||
}
|
||||
|
||||
if (reservation.getPhase() != null) {
|
||||
dto.setPhaseId(reservation.getPhase().getId());
|
||||
dto.setPhaseNom(reservation.getPhase().getNom());
|
||||
}
|
||||
|
||||
if (reservation.getPlanningMateriel() != null) {
|
||||
dto.setPlanningMaterielId(reservation.getPlanningMateriel().getId());
|
||||
}
|
||||
|
||||
// Métadonnées calculées
|
||||
dto.setDureeReservationJours(reservation.getDureeReservationJours());
|
||||
dto.setEstEnCours(reservation.estEnCours());
|
||||
dto.setEstEnRetard(reservation.estEnRetard());
|
||||
|
||||
return dto;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,126 +1,126 @@
|
||||
package dev.lions.btpxpress.domain.shared.mapper;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.Stock;
|
||||
import dev.lions.btpxpress.domain.shared.dto.StockCreateDTO;
|
||||
import dev.lions.btpxpress.domain.shared.dto.StockResponseDTO;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* Mapper pour les stocks - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@ApplicationScoped
|
||||
public class StockMapper {
|
||||
|
||||
/**
|
||||
* Conversion DTO vers entité
|
||||
*/
|
||||
public Stock toEntity(StockCreateDTO dto) {
|
||||
if (dto == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Stock stock = new Stock();
|
||||
stock.setReference(dto.getReference());
|
||||
stock.setDesignation(dto.getDesignation());
|
||||
stock.setDescription(dto.getDescription());
|
||||
stock.setCategorie(dto.getCategorie());
|
||||
stock.setSousCategorie(dto.getSousCategorie());
|
||||
stock.setUniteMesure(dto.getUniteMesure());
|
||||
stock.setQuantiteStock(dto.getQuantiteStock() != null ? dto.getQuantiteStock() : BigDecimal.ZERO);
|
||||
stock.setQuantiteMinimum(dto.getQuantiteMinimum());
|
||||
stock.setQuantiteMaximum(dto.getQuantiteMaximum());
|
||||
stock.setPrixUnitaireHT(dto.getPrixUnitaireHT());
|
||||
stock.setTauxTVA(dto.getTauxTVA() != null ? dto.getTauxTVA() : new BigDecimal("20.00"));
|
||||
stock.setEmplacementStockage(dto.getEmplacementStockage());
|
||||
stock.setCodeZone(dto.getCodeZone());
|
||||
stock.setCodeAllee(dto.getCodeAllee());
|
||||
stock.setCodeEtagere(dto.getCodeEtagere());
|
||||
stock.setMarque(dto.getMarque());
|
||||
stock.setModele(dto.getModele());
|
||||
stock.setReferenceFournisseur(dto.getReferenceFournisseur());
|
||||
stock.setCodeBarre(dto.getCodeBarre());
|
||||
stock.setCodeEAN(dto.getCodeEAN());
|
||||
|
||||
return stock;
|
||||
}
|
||||
|
||||
/**
|
||||
* Conversion entité vers ResponseDTO
|
||||
*/
|
||||
public StockResponseDTO toResponseDTO(Stock stock) {
|
||||
if (stock == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
StockResponseDTO dto = StockResponseDTO.builder()
|
||||
.id(stock.getId())
|
||||
.reference(stock.getReference())
|
||||
.designation(stock.getDesignation())
|
||||
.description(stock.getDescription())
|
||||
.categorie(stock.getCategorie())
|
||||
.sousCategorie(stock.getSousCategorie())
|
||||
.uniteMesure(stock.getUniteMesure())
|
||||
.quantiteStock(stock.getQuantiteStock())
|
||||
.quantiteMinimum(stock.getQuantiteMinimum())
|
||||
.quantiteMaximum(stock.getQuantiteMaximum())
|
||||
.quantiteSecurite(stock.getQuantiteSecurite())
|
||||
.quantiteReservee(stock.getQuantiteReservee())
|
||||
.quantiteEnCommande(stock.getQuantiteEnCommande())
|
||||
.prixUnitaireHT(stock.getPrixUnitaireHT())
|
||||
.coutMoyenPondere(stock.getCoutMoyenPondere())
|
||||
.coutDerniereEntree(stock.getCoutDerniereEntree())
|
||||
.tauxTVA(stock.getTauxTVA())
|
||||
.emplacementStockage(stock.getEmplacementStockage())
|
||||
.codeZone(stock.getCodeZone())
|
||||
.codeAllee(stock.getCodeAllee())
|
||||
.codeEtagere(stock.getCodeEtagere())
|
||||
.statut(stock.getStatut())
|
||||
.gestionParLot(stock.getGestionParLot())
|
||||
.traçabiliteRequise(stock.getTraçabiliteRequise())
|
||||
.articlePerissable(stock.getArticlePerissable())
|
||||
.controleQualiteRequis(stock.getControleQualiteRequis())
|
||||
.articleDangereux(stock.getArticleDangereux())
|
||||
.classeDanger(stock.getClasseDanger())
|
||||
.marque(stock.getMarque())
|
||||
.modele(stock.getModele())
|
||||
.referenceFournisseur(stock.getReferenceFournisseur())
|
||||
.codeBarre(stock.getCodeBarre())
|
||||
.codeEAN(stock.getCodeEAN())
|
||||
.dateCreation(stock.getDateCreation())
|
||||
.dateModification(stock.getDateModification())
|
||||
.creePar(stock.getCreePar())
|
||||
.modifiePar(stock.getModifiePar())
|
||||
.build();
|
||||
|
||||
// Relations simplifiées
|
||||
if (stock.getFournisseurPrincipal() != null) {
|
||||
dto.setFournisseurPrincipalId(stock.getFournisseurPrincipal().getId());
|
||||
dto.setFournisseurPrincipalNom(stock.getFournisseurPrincipal().getNom());
|
||||
}
|
||||
|
||||
if (stock.getChantier() != null) {
|
||||
dto.setChantierId(stock.getChantier().getId());
|
||||
dto.setChantierNom(stock.getChantier().getNom());
|
||||
}
|
||||
|
||||
// Calculs
|
||||
if (stock.getPrixUnitaireHT() != null && stock.getQuantiteStock() != null) {
|
||||
dto.setValeurStock(stock.getPrixUnitaireHT().multiply(stock.getQuantiteStock()));
|
||||
}
|
||||
|
||||
// Vérifier si en rupture
|
||||
if (stock.getQuantiteMinimum() != null && stock.getQuantiteStock() != null) {
|
||||
dto.setEnRupture(stock.getQuantiteStock().compareTo(stock.getQuantiteMinimum()) < 0);
|
||||
} else {
|
||||
dto.setEnRupture(false);
|
||||
}
|
||||
|
||||
return dto;
|
||||
}
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.mapper;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.Stock;
|
||||
import dev.lions.btpxpress.domain.shared.dto.StockCreateDTO;
|
||||
import dev.lions.btpxpress.domain.shared.dto.StockResponseDTO;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* Mapper pour les stocks - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@ApplicationScoped
|
||||
public class StockMapper {
|
||||
|
||||
/**
|
||||
* Conversion DTO vers entité
|
||||
*/
|
||||
public Stock toEntity(StockCreateDTO dto) {
|
||||
if (dto == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Stock stock = new Stock();
|
||||
stock.setReference(dto.getReference());
|
||||
stock.setDesignation(dto.getDesignation());
|
||||
stock.setDescription(dto.getDescription());
|
||||
stock.setCategorie(dto.getCategorie());
|
||||
stock.setSousCategorie(dto.getSousCategorie());
|
||||
stock.setUniteMesure(dto.getUniteMesure());
|
||||
stock.setQuantiteStock(dto.getQuantiteStock() != null ? dto.getQuantiteStock() : BigDecimal.ZERO);
|
||||
stock.setQuantiteMinimum(dto.getQuantiteMinimum());
|
||||
stock.setQuantiteMaximum(dto.getQuantiteMaximum());
|
||||
stock.setPrixUnitaireHT(dto.getPrixUnitaireHT());
|
||||
stock.setTauxTVA(dto.getTauxTVA() != null ? dto.getTauxTVA() : new BigDecimal("20.00"));
|
||||
stock.setEmplacementStockage(dto.getEmplacementStockage());
|
||||
stock.setCodeZone(dto.getCodeZone());
|
||||
stock.setCodeAllee(dto.getCodeAllee());
|
||||
stock.setCodeEtagere(dto.getCodeEtagere());
|
||||
stock.setMarque(dto.getMarque());
|
||||
stock.setModele(dto.getModele());
|
||||
stock.setReferenceFournisseur(dto.getReferenceFournisseur());
|
||||
stock.setCodeBarre(dto.getCodeBarre());
|
||||
stock.setCodeEAN(dto.getCodeEAN());
|
||||
|
||||
return stock;
|
||||
}
|
||||
|
||||
/**
|
||||
* Conversion entité vers ResponseDTO
|
||||
*/
|
||||
public StockResponseDTO toResponseDTO(Stock stock) {
|
||||
if (stock == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
StockResponseDTO dto = StockResponseDTO.builder()
|
||||
.id(stock.getId())
|
||||
.reference(stock.getReference())
|
||||
.designation(stock.getDesignation())
|
||||
.description(stock.getDescription())
|
||||
.categorie(stock.getCategorie())
|
||||
.sousCategorie(stock.getSousCategorie())
|
||||
.uniteMesure(stock.getUniteMesure())
|
||||
.quantiteStock(stock.getQuantiteStock())
|
||||
.quantiteMinimum(stock.getQuantiteMinimum())
|
||||
.quantiteMaximum(stock.getQuantiteMaximum())
|
||||
.quantiteSecurite(stock.getQuantiteSecurite())
|
||||
.quantiteReservee(stock.getQuantiteReservee())
|
||||
.quantiteEnCommande(stock.getQuantiteEnCommande())
|
||||
.prixUnitaireHT(stock.getPrixUnitaireHT())
|
||||
.coutMoyenPondere(stock.getCoutMoyenPondere())
|
||||
.coutDerniereEntree(stock.getCoutDerniereEntree())
|
||||
.tauxTVA(stock.getTauxTVA())
|
||||
.emplacementStockage(stock.getEmplacementStockage())
|
||||
.codeZone(stock.getCodeZone())
|
||||
.codeAllee(stock.getCodeAllee())
|
||||
.codeEtagere(stock.getCodeEtagere())
|
||||
.statut(stock.getStatut())
|
||||
.gestionParLot(stock.getGestionParLot())
|
||||
.traçabiliteRequise(stock.getTraçabiliteRequise())
|
||||
.articlePerissable(stock.getArticlePerissable())
|
||||
.controleQualiteRequis(stock.getControleQualiteRequis())
|
||||
.articleDangereux(stock.getArticleDangereux())
|
||||
.classeDanger(stock.getClasseDanger())
|
||||
.marque(stock.getMarque())
|
||||
.modele(stock.getModele())
|
||||
.referenceFournisseur(stock.getReferenceFournisseur())
|
||||
.codeBarre(stock.getCodeBarre())
|
||||
.codeEAN(stock.getCodeEAN())
|
||||
.dateCreation(stock.getDateCreation())
|
||||
.dateModification(stock.getDateModification())
|
||||
.creePar(stock.getCreePar())
|
||||
.modifiePar(stock.getModifiePar())
|
||||
.build();
|
||||
|
||||
// Relations simplifiées
|
||||
if (stock.getFournisseurPrincipal() != null) {
|
||||
dto.setFournisseurPrincipalId(stock.getFournisseurPrincipal().getId());
|
||||
dto.setFournisseurPrincipalNom(stock.getFournisseurPrincipal().getNom());
|
||||
}
|
||||
|
||||
if (stock.getChantier() != null) {
|
||||
dto.setChantierId(stock.getChantier().getId());
|
||||
dto.setChantierNom(stock.getChantier().getNom());
|
||||
}
|
||||
|
||||
// Calculs
|
||||
if (stock.getPrixUnitaireHT() != null && stock.getQuantiteStock() != null) {
|
||||
dto.setValeurStock(stock.getPrixUnitaireHT().multiply(stock.getQuantiteStock()));
|
||||
}
|
||||
|
||||
// Vérifier si en rupture
|
||||
if (stock.getQuantiteMinimum() != null && stock.getQuantiteStock() != null) {
|
||||
dto.setEnRupture(stock.getQuantiteStock().compareTo(stock.getQuantiteMinimum()) < 0);
|
||||
} else {
|
||||
dto.setEnRupture(false);
|
||||
}
|
||||
|
||||
return dto;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,86 +1,86 @@
|
||||
package dev.lions.btpxpress.domain.shared.mapper;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.User;
|
||||
import dev.lions.btpxpress.domain.shared.dto.UserCreateDTO;
|
||||
import dev.lions.btpxpress.domain.shared.dto.UserResponseDTO;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
|
||||
/**
|
||||
* Mapper pour les utilisateurs - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@ApplicationScoped
|
||||
public class UserMapper {
|
||||
|
||||
/**
|
||||
* Conversion DTO vers entité
|
||||
* Note: Le mot de passe doit être hashé avant d'être assigné à l'entité
|
||||
*/
|
||||
public User toEntity(UserCreateDTO dto) {
|
||||
if (dto == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
User user = new User();
|
||||
user.setEmail(dto.getEmail());
|
||||
user.setNom(dto.getNom());
|
||||
user.setPrenom(dto.getPrenom());
|
||||
// Le mot de passe doit être hashé par le service avant d'être assigné
|
||||
user.setPassword(dto.getPassword()); // Le service devra le hasher
|
||||
user.setRole(dto.getRole() != null ? dto.getRole() : dev.lions.btpxpress.domain.core.entity.UserRole.OUVRIER);
|
||||
user.setActif(dto.getActif() != null ? dto.getActif() : true);
|
||||
user.setStatus(dto.getStatus() != null ? dto.getStatus() : dev.lions.btpxpress.domain.core.entity.UserStatus.PENDING);
|
||||
user.setTelephone(dto.getTelephone());
|
||||
user.setAdresse(dto.getAdresse());
|
||||
user.setCodePostal(dto.getCodePostal());
|
||||
user.setVille(dto.getVille());
|
||||
user.setEntreprise(dto.getEntreprise());
|
||||
user.setSiret(dto.getSiret());
|
||||
user.setSecteurActivite(dto.getSecteurActivite());
|
||||
user.setEffectif(dto.getEffectif());
|
||||
user.setCommentaireAdmin(dto.getCommentaireAdmin());
|
||||
|
||||
return user;
|
||||
}
|
||||
|
||||
/**
|
||||
* Conversion entité vers ResponseDTO
|
||||
* Note: Le mot de passe n'est jamais inclus pour des raisons de sécurité
|
||||
*/
|
||||
public UserResponseDTO toResponseDTO(User user) {
|
||||
if (user == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
UserResponseDTO dto = UserResponseDTO.builder()
|
||||
.id(user.getId())
|
||||
.email(user.getEmail())
|
||||
.nom(user.getNom())
|
||||
.prenom(user.getPrenom())
|
||||
.role(user.getRole())
|
||||
.actif(user.getActif())
|
||||
.status(user.getStatus())
|
||||
.telephone(user.getTelephone())
|
||||
.adresse(user.getAdresse())
|
||||
.codePostal(user.getCodePostal())
|
||||
.ville(user.getVille())
|
||||
.entreprise(user.getEntreprise())
|
||||
.siret(user.getSiret())
|
||||
.secteurActivite(user.getSecteurActivite())
|
||||
.effectif(user.getEffectif())
|
||||
.commentaireAdmin(user.getCommentaireAdmin())
|
||||
.dateCreation(user.getDateCreation())
|
||||
.dateModification(user.getDateModification())
|
||||
.derniereConnexion(user.getDerniereConnexion())
|
||||
.build();
|
||||
|
||||
// Métadonnées calculées
|
||||
dto.setCanLogin(user.canLogin());
|
||||
|
||||
return dto;
|
||||
}
|
||||
}
|
||||
|
||||
package dev.lions.btpxpress.domain.shared.mapper;
|
||||
|
||||
import dev.lions.btpxpress.domain.core.entity.User;
|
||||
import dev.lions.btpxpress.domain.shared.dto.UserCreateDTO;
|
||||
import dev.lions.btpxpress.domain.shared.dto.UserResponseDTO;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
|
||||
/**
|
||||
* Mapper pour les utilisateurs - Architecture 2025
|
||||
*
|
||||
* @author BTPXpress Team
|
||||
* @version 1.0
|
||||
* @since 2025-01-30
|
||||
*/
|
||||
@ApplicationScoped
|
||||
public class UserMapper {
|
||||
|
||||
/**
|
||||
* Conversion DTO vers entité
|
||||
* Note: Le mot de passe doit être hashé avant d'être assigné à l'entité
|
||||
*/
|
||||
public User toEntity(UserCreateDTO dto) {
|
||||
if (dto == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
User user = new User();
|
||||
user.setEmail(dto.getEmail());
|
||||
user.setNom(dto.getNom());
|
||||
user.setPrenom(dto.getPrenom());
|
||||
// Le mot de passe doit être hashé par le service avant d'être assigné
|
||||
user.setPassword(dto.getPassword()); // Le service devra le hasher
|
||||
user.setRole(dto.getRole() != null ? dto.getRole() : dev.lions.btpxpress.domain.core.entity.UserRole.OUVRIER);
|
||||
user.setActif(dto.getActif() != null ? dto.getActif() : true);
|
||||
user.setStatus(dto.getStatus() != null ? dto.getStatus() : dev.lions.btpxpress.domain.core.entity.UserStatus.PENDING);
|
||||
user.setTelephone(dto.getTelephone());
|
||||
user.setAdresse(dto.getAdresse());
|
||||
user.setCodePostal(dto.getCodePostal());
|
||||
user.setVille(dto.getVille());
|
||||
user.setEntreprise(dto.getEntreprise());
|
||||
user.setSiret(dto.getSiret());
|
||||
user.setSecteurActivite(dto.getSecteurActivite());
|
||||
user.setEffectif(dto.getEffectif());
|
||||
user.setCommentaireAdmin(dto.getCommentaireAdmin());
|
||||
|
||||
return user;
|
||||
}
|
||||
|
||||
/**
|
||||
* Conversion entité vers ResponseDTO
|
||||
* Note: Le mot de passe n'est jamais inclus pour des raisons de sécurité
|
||||
*/
|
||||
public UserResponseDTO toResponseDTO(User user) {
|
||||
if (user == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
UserResponseDTO dto = UserResponseDTO.builder()
|
||||
.id(user.getId())
|
||||
.email(user.getEmail())
|
||||
.nom(user.getNom())
|
||||
.prenom(user.getPrenom())
|
||||
.role(user.getRole())
|
||||
.actif(user.getActif())
|
||||
.status(user.getStatus())
|
||||
.telephone(user.getTelephone())
|
||||
.adresse(user.getAdresse())
|
||||
.codePostal(user.getCodePostal())
|
||||
.ville(user.getVille())
|
||||
.entreprise(user.getEntreprise())
|
||||
.siret(user.getSiret())
|
||||
.secteurActivite(user.getSecteurActivite())
|
||||
.effectif(user.getEffectif())
|
||||
.commentaireAdmin(user.getCommentaireAdmin())
|
||||
.dateCreation(user.getDateCreation())
|
||||
.dateModification(user.getDateModification())
|
||||
.derniereConnexion(user.getDerniereConnexion())
|
||||
.build();
|
||||
|
||||
// Métadonnées calculées
|
||||
dto.setCanLogin(user.canLogin());
|
||||
|
||||
return dto;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
quarkus.datasource.jdbc.url=${DB_URL:jdbc:postgresql://postgres:5432/btpxpress}
|
||||
quarkus.datasource.username=${DB_USERNAME:btpxpress_user}
|
||||
quarkus.datasource.password=${DB_PASSWORD}
|
||||
quarkus.hibernate-orm.database.generation=validate
|
||||
quarkus.hibernate-orm.schema-management.strategy=validate
|
||||
quarkus.hibernate-orm.log.sql=false
|
||||
quarkus.hibernate-orm.log.bind-parameters=false
|
||||
|
||||
@@ -22,7 +22,7 @@ quarkus.http.host=0.0.0.0
|
||||
# External URL: https://api.lions.dev/btpxpress/... → Backend receives: /...
|
||||
|
||||
# CORS Configuration pour production
|
||||
quarkus.http.cors=true
|
||||
quarkus.http.cors.enabled=true
|
||||
quarkus.http.cors.origins=https://btpxpress.lions.dev
|
||||
quarkus.http.cors.methods=GET,POST,PUT,DELETE,OPTIONS
|
||||
quarkus.http.cors.headers=Content-Type,Authorization,X-Requested-With
|
||||
|
||||
@@ -9,8 +9,8 @@ quarkus.datasource.password=${DB_PASSWORD:?DB_PASSWORD must be set}
|
||||
|
||||
# Configuration de performance et optimisation
|
||||
quarkus.hibernate-orm.sql-load-script=no-file
|
||||
quarkus.hibernate-orm.database.generation=drop-and-create
|
||||
quarkus.hibernate-orm.log.sql=true
|
||||
quarkus.hibernate-orm.schema-management.strategy=drop-and-create
|
||||
quarkus.hibernate-orm.log.sql=false
|
||||
quarkus.hibernate-orm.log.bind-parameters=false
|
||||
|
||||
# Optimisation des connexions de base de données
|
||||
@@ -75,7 +75,7 @@ quarkus.http.host=0.0.0.0
|
||||
quarkus.http.non-application-root-path=/q
|
||||
|
||||
# CORS pour développement
|
||||
quarkus.http.cors=true
|
||||
quarkus.http.cors.enabled=true
|
||||
quarkus.http.cors.origins=${CORS_ORIGINS:http://localhost:3000,http://localhost:5173,http://localhost:8081}
|
||||
quarkus.http.cors.methods=GET,POST,PUT,DELETE,OPTIONS
|
||||
quarkus.http.cors.headers=Content-Type,Authorization,X-Requested-With
|
||||
@@ -133,15 +133,17 @@ quarkus.arc.detect-unused-false-positives=false
|
||||
|
||||
# Logging
|
||||
quarkus.log.level=INFO
|
||||
quarkus.log.category."dev.lions.btpxpress".level=DEBUG
|
||||
quarkus.log.category."io.agroal".level=DEBUG
|
||||
quarkus.log.category."dev.lions.btpxpress".level=INFO
|
||||
quarkus.log.category."io.agroal".level=WARN
|
||||
quarkus.log.category."io.vertx.core.impl.BlockedThreadChecker".level=WARN
|
||||
quarkus.log.category."org.hibernate".level=DEBUG
|
||||
quarkus.log.category."io.quarkus.smallrye.jwt".level=DEBUG
|
||||
quarkus.log.category."org.hibernate".level=WARN
|
||||
quarkus.log.category."io.quarkus.smallrye.jwt".level=WARN
|
||||
quarkus.log.console.format=%d{HH:mm:ss} %-5p [%c{2.}] (%t) %s%e%n
|
||||
quarkus.log.console.color=true
|
||||
quarkus.log.async=true
|
||||
quarkus.log.async.queue-length=16384
|
||||
quarkus.log.console.color=false
|
||||
|
||||
# Dev Mode - Active les logs de debug
|
||||
%dev.quarkus.log.category."dev.lions.btpxpress".level=DEBUG
|
||||
%dev.quarkus.log.console.color=true
|
||||
|
||||
# Métriques et monitoring
|
||||
quarkus.micrometer.export.prometheus.enabled=true
|
||||
|
||||
@@ -1,63 +1,63 @@
|
||||
# Configuration complète pour les tests
|
||||
# Consolidation de toutes les configurations des fichiers .yml
|
||||
|
||||
# ===== PORT HTTP - Port aléatoire pour éviter conflits =====
|
||||
%test.quarkus.http.port=0
|
||||
%test.quarkus.http.test-port=0
|
||||
%test.quarkus.http.host=127.0.0.1
|
||||
|
||||
# ===== BASE DE DONNÉES H2 EN MÉMOIRE =====
|
||||
%test.quarkus.datasource.db-kind=h2
|
||||
%test.quarkus.datasource.username=sa
|
||||
%test.quarkus.datasource.password=
|
||||
%test.quarkus.datasource.jdbc.url=jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE;MODE=PostgreSQL
|
||||
%test.quarkus.datasource.jdbc.driver=org.h2.Driver
|
||||
|
||||
# ===== HIBERNATE ORM =====
|
||||
%test.quarkus.hibernate-orm.database.generation=drop-and-create
|
||||
%test.quarkus.hibernate-orm.log.sql=false
|
||||
%test.quarkus.hibernate-orm.log.bind-parameters=false
|
||||
%test.quarkus.hibernate-orm.dialect=org.hibernate.dialect.H2Dialect
|
||||
|
||||
# ===== FLYWAY - DÉSACTIVÉ =====
|
||||
%test.quarkus.flyway.migrate-at-start=false
|
||||
|
||||
# ===== SÉCURITÉ COMPLÈTEMENT DÉSACTIVÉE POUR TESTS =====
|
||||
%test.quarkus.security.auth.enabled=false
|
||||
%test.quarkus.security.jaxrs.deny-unannotated-endpoints=false
|
||||
%test.quarkus.oidc.enabled=false
|
||||
%test.quarkus.oidc.tenant-enabled=false
|
||||
%test.quarkus.smallrye-jwt.enabled=false
|
||||
|
||||
# ===== PERMISSIONS HTTP - TOUT PERMIS =====
|
||||
%test.quarkus.http.auth.permission.authenticated.paths=/*
|
||||
%test.quarkus.http.auth.permission.authenticated.policy=permit
|
||||
|
||||
# ===== CORS POUR TESTS =====
|
||||
%test.quarkus.http.cors=true
|
||||
%test.quarkus.http.cors.origins=*
|
||||
%test.quarkus.http.cors.methods=*
|
||||
%test.quarkus.http.cors.headers=*
|
||||
|
||||
# ===== LOGGING =====
|
||||
%test.quarkus.log.level=WARN
|
||||
%test.quarkus.log.category."dev.lions.btpxpress".level=DEBUG
|
||||
%test.quarkus.log.category."io.quarkus.security".level=DEBUG
|
||||
%test.quarkus.log.category."org.hibernate".level=WARN
|
||||
%test.quarkus.log.category."io.quarkus".level=WARN
|
||||
|
||||
# ===== FEATURES NON NÉCESSAIRES EN TEST =====
|
||||
%test.quarkus.swagger-ui.enable=false
|
||||
%test.quarkus.health.extensions.enabled=false
|
||||
%test.quarkus.micrometer.enabled=false
|
||||
%test.quarkus.opentelemetry.enabled=false
|
||||
|
||||
# ===== DEV SERVICES DÉSACTIVÉS =====
|
||||
%test.quarkus.devservices.enabled=false
|
||||
|
||||
# ===== CONFIGURATION MAVEN/AETHER (pour éviter conflits Quarkus) =====
|
||||
%test.quarkus.maven.resolver.transport=wagon
|
||||
|
||||
# ===== JWT POUR TESTS (si nécessaire) =====
|
||||
%test.jwt.secret=test-secret-key-for-jwt-token-generation-that-is-long-enough-for-hmac-sha256-algorithm-requirements
|
||||
%test.jwt.expiration=3600
|
||||
# Configuration complète pour les tests
|
||||
# Consolidation de toutes les configurations des fichiers .yml
|
||||
|
||||
# ===== PORT HTTP - Port aléatoire pour éviter conflits =====
|
||||
%test.quarkus.http.port=0
|
||||
%test.quarkus.http.test-port=0
|
||||
%test.quarkus.http.host=127.0.0.1
|
||||
|
||||
# ===== BASE DE DONNÉES H2 EN MÉMOIRE =====
|
||||
%test.quarkus.datasource.db-kind=h2
|
||||
%test.quarkus.datasource.username=sa
|
||||
%test.quarkus.datasource.password=
|
||||
%test.quarkus.datasource.jdbc.url=jdbc:h2:mem:testdb;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE;MODE=PostgreSQL
|
||||
%test.quarkus.datasource.jdbc.driver=org.h2.Driver
|
||||
|
||||
# ===== HIBERNATE ORM =====
|
||||
%test.quarkus.hibernate-orm.database.generation=drop-and-create
|
||||
%test.quarkus.hibernate-orm.log.sql=false
|
||||
%test.quarkus.hibernate-orm.log.bind-parameters=false
|
||||
%test.quarkus.hibernate-orm.dialect=org.hibernate.dialect.H2Dialect
|
||||
|
||||
# ===== FLYWAY - DÉSACTIVÉ =====
|
||||
%test.quarkus.flyway.migrate-at-start=false
|
||||
|
||||
# ===== SÉCURITÉ COMPLÈTEMENT DÉSACTIVÉE POUR TESTS =====
|
||||
%test.quarkus.security.auth.enabled=false
|
||||
%test.quarkus.security.jaxrs.deny-unannotated-endpoints=false
|
||||
%test.quarkus.oidc.enabled=false
|
||||
%test.quarkus.oidc.tenant-enabled=false
|
||||
%test.quarkus.smallrye-jwt.enabled=false
|
||||
|
||||
# ===== PERMISSIONS HTTP - TOUT PERMIS =====
|
||||
%test.quarkus.http.auth.permission.authenticated.paths=/*
|
||||
%test.quarkus.http.auth.permission.authenticated.policy=permit
|
||||
|
||||
# ===== CORS POUR TESTS =====
|
||||
%test.quarkus.http.cors=true
|
||||
%test.quarkus.http.cors.origins=*
|
||||
%test.quarkus.http.cors.methods=*
|
||||
%test.quarkus.http.cors.headers=*
|
||||
|
||||
# ===== LOGGING =====
|
||||
%test.quarkus.log.level=WARN
|
||||
%test.quarkus.log.category."dev.lions.btpxpress".level=WARN
|
||||
%test.quarkus.log.category."io.quarkus.security".level=WARN
|
||||
%test.quarkus.log.category."org.hibernate".level=WARN
|
||||
%test.quarkus.log.category."io.quarkus".level=WARN
|
||||
|
||||
# ===== FEATURES NON NÉCESSAIRES EN TEST =====
|
||||
%test.quarkus.swagger-ui.enable=false
|
||||
%test.quarkus.health.extensions.enabled=false
|
||||
%test.quarkus.micrometer.enabled=false
|
||||
%test.quarkus.opentelemetry.enabled=false
|
||||
|
||||
# ===== DEV SERVICES DÉSACTIVÉS =====
|
||||
%test.quarkus.devservices.enabled=false
|
||||
|
||||
# ===== CONFIGURATION MAVEN/AETHER (pour éviter conflits Quarkus) =====
|
||||
%test.quarkus.maven.resolver.transport=wagon
|
||||
|
||||
# ===== JWT POUR TESTS (si nécessaire) =====
|
||||
%test.jwt.secret=test-secret-key-for-jwt-token-generation-that-is-long-enough-for-hmac-sha256-algorithm-requirements
|
||||
%test.jwt.expiration=3600
|
||||
|
||||
Reference in New Issue
Block a user