253 lines
5.7 KiB
Markdown
253 lines
5.7 KiB
Markdown
# 👷 CONCEPT: EMPLOYE
|
|
|
|
## 📌 Vue d'ensemble
|
|
|
|
Le concept **EMPLOYE** gère les ressources humaines : employés, compétences, équipes, et affectations aux chantiers.
|
|
|
|
**Importance**: ⭐⭐⭐⭐ (Concept stratégique)
|
|
|
|
---
|
|
|
|
## 🗂️ Fichiers concernés
|
|
|
|
### **Entités JPA**
|
|
| Fichier | Description |
|
|
|---------|-------------|
|
|
| `Employe.java` | Entité principale employé |
|
|
| `EmployeCompetence.java` | Compétences d'un employé |
|
|
| `FonctionEmploye.java` | Enum fonctions |
|
|
| `StatutEmploye.java` | Enum (ACTIF, CONGE, ARRET_MALADIE, FORMATION, INACTIF) |
|
|
| `NiveauCompetence.java` | Enum niveaux de compétence |
|
|
| `Equipe.java` | Entité équipe |
|
|
| `StatutEquipe.java` | Enum (ACTIVE, INACTIVE, EN_MISSION, DISPONIBLE) |
|
|
|
|
### **Services**
|
|
| Fichier | Description |
|
|
|---------|-------------|
|
|
| `EmployeService.java` | Service métier employés |
|
|
| `EquipeService.java` | Service métier équipes |
|
|
|
|
### **Resources**
|
|
| Fichier | Description |
|
|
|---------|-------------|
|
|
| `EmployeResource.java` | API REST employés |
|
|
| `EquipeResource.java` | API REST équipes |
|
|
|
|
---
|
|
|
|
## 📊 Modèle de données
|
|
|
|
### **Entité Employe**
|
|
|
|
```java
|
|
@Entity
|
|
@Table(name = "employes")
|
|
public class Employe extends PanacheEntityBase {
|
|
@Id
|
|
@GeneratedValue(strategy = GenerationType.UUID)
|
|
private UUID id;
|
|
|
|
@Column(name = "nom", nullable = false)
|
|
private String nom;
|
|
|
|
@Column(name = "prenom", nullable = false)
|
|
private String prenom;
|
|
|
|
@Column(name = "email", unique = true)
|
|
private String email;
|
|
|
|
@Column(name = "telephone")
|
|
private String telephone;
|
|
|
|
@Enumerated(EnumType.STRING)
|
|
@Column(name = "fonction")
|
|
private FonctionEmploye fonction;
|
|
|
|
@Enumerated(EnumType.STRING)
|
|
@Column(name = "statut")
|
|
private StatutEmploye statut = StatutEmploye.ACTIF;
|
|
|
|
@Column(name = "date_embauche")
|
|
private LocalDate dateEmbauche;
|
|
|
|
@Column(name = "taux_horaire", precision = 10, scale = 2)
|
|
private BigDecimal tauxHoraire;
|
|
|
|
@ManyToOne
|
|
@JoinColumn(name = "equipe_id")
|
|
private Equipe equipe;
|
|
|
|
@OneToMany(mappedBy = "employe", cascade = CascadeType.ALL)
|
|
private List<EmployeCompetence> competences;
|
|
}
|
|
```
|
|
|
|
### **Enum FonctionEmploye**
|
|
|
|
```java
|
|
public enum FonctionEmploye {
|
|
CHEF_CHANTIER,
|
|
CONDUCTEUR_TRAVAUX,
|
|
MACON,
|
|
ELECTRICIEN,
|
|
PLOMBIER,
|
|
CHARPENTIER,
|
|
COUVREUR,
|
|
PEINTRE,
|
|
CARRELEUR,
|
|
MENUISIER,
|
|
TERRASSIER,
|
|
GRUTIER,
|
|
MANOEUVRE,
|
|
AUTRE
|
|
}
|
|
```
|
|
|
|
### **Enum StatutEmploye**
|
|
|
|
```java
|
|
public enum StatutEmploye {
|
|
ACTIF, // Actif et disponible
|
|
CONGE, // En congé
|
|
ARRET_MALADIE, // Arrêt maladie
|
|
FORMATION, // En formation
|
|
INACTIF // Inactif (démission, licenciement)
|
|
}
|
|
```
|
|
|
|
---
|
|
|
|
## 🔌 API REST
|
|
|
|
### **Endpoints Employés**
|
|
|
|
| Méthode | Endpoint | Description |
|
|
|---------|----------|-------------|
|
|
| GET | `/api/v1/employes` | Liste employés |
|
|
| GET | `/api/v1/employes/{id}` | Détails |
|
|
| POST | `/api/v1/employes` | Créer |
|
|
| PUT | `/api/v1/employes/{id}` | Modifier |
|
|
| DELETE | `/api/v1/employes/{id}` | Supprimer |
|
|
| GET | `/api/v1/employes/disponibles` | Employés disponibles |
|
|
| GET | `/api/v1/employes/fonction/{fonction}` | Par fonction |
|
|
| GET | `/api/v1/employes/stats` | Statistiques |
|
|
|
|
### **Endpoints Équipes**
|
|
|
|
| Méthode | Endpoint | Description |
|
|
|---------|----------|-------------|
|
|
| GET | `/api/v1/equipes` | Liste équipes |
|
|
| GET | `/api/v1/equipes/{id}` | Détails |
|
|
| POST | `/api/v1/equipes` | Créer |
|
|
| PUT | `/api/v1/equipes/{id}` | Modifier |
|
|
| POST | `/api/v1/equipes/{id}/membres` | Ajouter membre |
|
|
| DELETE | `/api/v1/equipes/{id}/membres/{employeId}` | Retirer membre |
|
|
|
|
---
|
|
|
|
## 💻 Exemples
|
|
|
|
### **Créer un employé**
|
|
|
|
```bash
|
|
curl -X POST http://localhost:8080/api/v1/employes \
|
|
-H "Content-Type: application/json" \
|
|
-d '{
|
|
"nom": "Martin",
|
|
"prenom": "Pierre",
|
|
"email": "pierre.martin@btpxpress.fr",
|
|
"telephone": "+33 6 12 34 56 78",
|
|
"fonction": "MACON",
|
|
"dateEmbauche": "2025-01-15",
|
|
"tauxHoraire": 25.00,
|
|
"competences": [
|
|
{
|
|
"nom": "Maçonnerie traditionnelle",
|
|
"niveau": "EXPERT"
|
|
},
|
|
{
|
|
"nom": "Coffrage",
|
|
"niveau": "CONFIRME"
|
|
}
|
|
]
|
|
}'
|
|
```
|
|
|
|
### **Créer une équipe**
|
|
|
|
```bash
|
|
curl -X POST http://localhost:8080/api/v1/equipes \
|
|
-H "Content-Type: application/json" \
|
|
-d '{
|
|
"nom": "Équipe Gros Œuvre A",
|
|
"chefEquipeId": "employe-uuid",
|
|
"membreIds": ["uuid1", "uuid2", "uuid3"]
|
|
}'
|
|
```
|
|
|
|
### **Employés disponibles**
|
|
|
|
```bash
|
|
curl -X GET http://localhost:8080/api/v1/employes/disponibles
|
|
```
|
|
|
|
**Réponse**:
|
|
```json
|
|
[
|
|
{
|
|
"id": "uuid",
|
|
"nom": "Martin",
|
|
"prenom": "Pierre",
|
|
"fonction": "MACON",
|
|
"statut": "ACTIF",
|
|
"equipe": "Équipe Gros Œuvre A",
|
|
"competences": ["Maçonnerie", "Coffrage"]
|
|
}
|
|
]
|
|
```
|
|
|
|
---
|
|
|
|
## 🔧 Services métier
|
|
|
|
### **EmployeService**
|
|
|
|
**Méthodes principales**:
|
|
- `findAll()` - Tous les employés
|
|
- `findDisponibles()` - Employés disponibles
|
|
- `findByFonction(FonctionEmploye)` - Par fonction
|
|
- `create(EmployeDTO)` - Créer
|
|
- `update(UUID id, EmployeDTO)` - Modifier
|
|
- `changerStatut(UUID id, StatutEmploye)` - Changer statut
|
|
|
|
### **EquipeService**
|
|
|
|
**Méthodes principales**:
|
|
- `create(EquipeDTO)` - Créer équipe
|
|
- `ajouterMembre(UUID equipeId, UUID employeId)` - Ajouter membre
|
|
- `retirerMembre(UUID equipeId, UUID employeId)` - Retirer membre
|
|
|
|
---
|
|
|
|
## 📈 Relations
|
|
|
|
- **EQUIPE** ⬅️ Un employé appartient à une équipe
|
|
- **CHANTIER** ➡️ Un employé peut être affecté à des chantiers
|
|
- **USER** ⬅️ Un employé peut avoir un compte utilisateur
|
|
|
|
---
|
|
|
|
## ✅ Validations
|
|
|
|
- ✅ Nom et prénom obligatoires
|
|
- ✅ Email unique
|
|
- ✅ Fonction obligatoire
|
|
- ✅ Taux horaire positif
|
|
- ✅ Date d'embauche cohérente
|
|
|
|
---
|
|
|
|
**Dernière mise à jour**: 2025-09-30
|
|
**Version**: 1.0
|
|
|