Class PrestamoServiceImp

java.lang.Object
com.tfg.crud.GestorBiblioteca.service.PrestamoServiceImp
All Implemented Interfaces:
PrestamoService

@Service public class PrestamoServiceImp extends Object implements PrestamoService
Author:
Usuario
  • Constructor Details

    • PrestamoServiceImp

      public PrestamoServiceImp()
  • Method Details

    • registrarPrestamo

      public Prestamo registrarPrestamo(PrestamoDTO prestamoDTO)
      Description copied from interface: PrestamoService
      Registra un nuevo préstamo en el sistema.
      Specified by:
      registrarPrestamo in interface PrestamoService
      Parameters:
      prestamoDTO - datos necesarios para crear el préstamo
      Returns:
      préstamo registrado
    • buscarPrestamoPorId

      public Prestamo buscarPrestamoPorId(Long idPrestamo)
      Description copied from interface: PrestamoService
      Busca préstamos por su identificador.
      Specified by:
      buscarPrestamoPorId in interface PrestamoService
      Parameters:
      idPrestamo - identificador del préstamo
      Returns:
      préstamo encontrado
    • editarPrestamo

      public Prestamo editarPrestamo(Long idPrestamo, PrestamoDTO prestamoDTO)
      Description copied from interface: PrestamoService
      Edita un préstamo existente.
      Specified by:
      editarPrestamo in interface PrestamoService
      Parameters:
      idPrestamo - identificador del préstamo
      prestamoDTO - datos actualizados del préstamo
      Returns:
      préstamo modificado
    • finalizarPrestamo

      public void finalizarPrestamo(LocalDate fechaDevolucion, Long idPrestamo, String codigo)
      Description copied from interface: PrestamoService
      Finaliza un préstamo estableciendo su fecha de devolución.
      Specified by:
      finalizarPrestamo in interface PrestamoService
      Parameters:
      fechaDevolucion - fecha en la que se devuelve el ejemplar
      idPrestamo - indentificador del préstamo
      codigo - código del ejemplar
    • reabrirPrestamo

      public void reabrirPrestamo(Long idPrestamo)
      Description copied from interface: PrestamoService
      Reabre un préstamo previamente finalizado.
      Specified by:
      reabrirPrestamo in interface PrestamoService
      Parameters:
      idPrestamo - identificador del préstamo
    • sumarDiasHabiles

      public LocalDate sumarDiasHabiles(LocalDate fechaInicio)
      Description copied from interface: PrestamoService
      Calcula una fecha sumando días hábiles a una fecha inicial.
      Specified by:
      sumarDiasHabiles in interface PrestamoService
      Parameters:
      fechaInicio - fecha de inicio
      Returns:
      fecha resultante
    • cambiarEstado

      public void cambiarEstado(Long idPrestamo, EstadoPrestamo estadoPrestamo)
      Description copied from interface: PrestamoService
      Cambia el estado de un préstamo.
      Specified by:
      cambiarEstado in interface PrestamoService
      Parameters:
      idPrestamo - identificador del préstamo
      estadoPrestamo - nuevo estado del préstamo
    • buscarPrestamos

      public org.springframework.data.domain.Page<Prestamo> buscarPrestamos(String busqueda, EstadoPrestamo estadoPrestamo, org.springframework.data.domain.Pageable pageable)
      Description copied from interface: PrestamoService
      Busca préstamos aplicando filtros y paginación
      Specified by:
      buscarPrestamos in interface PrestamoService
      Parameters:
      busqueda - texto de búsqueda
      estadoPrestamo - estado del préstamo
      pageable - configuración de paginación
      Returns:
      página de préstamos encontrados
    • listarPrestamosPorUsuario

      public List<Prestamo> listarPrestamosPorUsuario(Long idUsuario)
      Description copied from interface: PrestamoService
      Lista de todos los préstamoas asociados a un usuario.
      Specified by:
      listarPrestamosPorUsuario in interface PrestamoService
      Parameters:
      idUsuario - identificador del usuario
      Returns:
      lista de préstamos del usuario
    • getPrestamoActivo

      public Prestamo getPrestamoActivo(Ejemplar e)
      Description copied from interface: PrestamoService
      Obtiene el préstamo activo asociado a un ejemplar.
      Specified by:
      getPrestamoActivo in interface PrestamoService
      Parameters:
      e - ejemplar consultado
      Returns:
      préstamo activo si existe
    • actualizarPrestamosRetrasados

      public void actualizarPrestamosRetrasados()
      Description copied from interface: PrestamoService
      Actualiza el estado de los préstamos retrasados en el sistema.
      Specified by:
      actualizarPrestamosRetrasados in interface PrestamoService