mirror of
https://git.imnavajas.es/jjimenez/erp-imprimelibros.git
synced 2026-01-28 14:48:50 +00:00
27 lines
870 B
Java
27 lines
870 B
Java
package com.imprimelibros.erp.pedido;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
@Service
|
|
public class PedidoService {
|
|
|
|
public int getDescuentoFidelizacion() {
|
|
// descuento entre el 1% y el 6% para clientes fidelidad (mas de 1500€ en el ultimo año)
|
|
double totalGastado = 1600.0; // Ejemplo, deberías obtenerlo del historial del cliente
|
|
if(totalGastado < 1200) {
|
|
return 0;
|
|
} else if(totalGastado >= 1200 && totalGastado < 1999) {
|
|
return 1;
|
|
} else if(totalGastado >= 2000 && totalGastado < 2999) {
|
|
return 2;
|
|
} else if(totalGastado >= 3000 && totalGastado < 3999) {
|
|
return 3;
|
|
} else if(totalGastado >= 4000 && totalGastado < 4999) {
|
|
return 4;
|
|
} else if(totalGastado >= 5000) {
|
|
return 5;
|
|
}
|
|
return 0;
|
|
}
|
|
}
|