├── doc ├── module-search-index.js ├── resource-files │ ├── x.png │ ├── glass.png │ ├── jquery-ui.min.css │ ├── copy.svg │ └── link.svg ├── tag-search-index.js ├── element-list ├── package-search-index.js ├── overview-summary.html ├── legal │ ├── ASSEMBLY_EXCEPTION │ ├── jqueryUI.md │ └── ADDITIONAL_LICENSE_INFO └── com │ └── inventory │ ├── package-use.html │ ├── demo │ ├── package-use.html │ └── package-tree.html │ ├── controller │ ├── package-use.html │ └── class-use │ │ ├── RolController.html │ │ ├── MarcaController.html │ │ ├── AlmacenController.html │ │ ├── UsuarioController.html │ │ ├── ProductoController.html │ │ └── RestAuthController.html │ ├── entity │ └── class-use │ │ ├── Movimientos.html │ │ ├── ProductoAtributo.html │ │ └── DetalleOrdenCompra.html │ ├── service │ └── class-use │ │ ├── RolService.html │ │ ├── MarcaService.html │ │ ├── AlmacenService.html │ │ ├── UsuarioService.html │ │ ├── ProductoService.html │ │ ├── CategoriaService.html │ │ ├── ProveedorService.html │ │ ├── UbicacionService.html │ │ ├── EstatusOrdenService.html │ │ ├── TipoProductoService.html │ │ ├── UnidadMedidaService.html │ │ └── TipoMovimientoService.html │ ├── security │ └── class-use │ │ ├── SecurityConfig.html │ │ └── ConstantesSeguridad.html │ └── class-use │ └── InventorySpringSecurityApplication.html ├── src ├── main │ ├── java │ │ └── com │ │ │ └── inventory │ │ │ ├── security │ │ │ ├── ConstantesSeguridad.java │ │ │ ├── JwtAuthenticationEntryPoint.java │ │ │ ├── CustomUsersDetailsService.java │ │ │ └── JwtGenerador.java │ │ │ ├── dto │ │ │ ├── RolDto.java │ │ │ ├── UnidadMedidaDto.java │ │ │ ├── EstatusOrdenDto.java │ │ │ ├── ValorAtributoDto.java │ │ │ ├── TipoMovimientoDto.java │ │ │ ├── UsuarioDto.java │ │ │ ├── UbicacionDto.java │ │ │ ├── ProductosDto.java │ │ │ ├── ProveedorDto.java │ │ │ ├── AtributoDto.java │ │ │ ├── CategoriaProductoDto.java │ │ │ ├── GrupoDto.java │ │ │ ├── RegistroResponseDto.java │ │ │ ├── LoginDto.java │ │ │ ├── AlmacenDto.java │ │ │ ├── RegistroUsuarioEmpleadoDto.java │ │ │ ├── EmpleadoDto.java │ │ │ ├── AuthRespuestaDto.java │ │ │ ├── MarcaDto.java │ │ │ ├── PasswordDto.java │ │ │ ├── CategoriaDto.java │ │ │ ├── UsuarioActualDto.java │ │ │ ├── ProductoDto.java │ │ │ └── ProductoSimplificadoDto.java │ │ │ ├── service │ │ │ ├── ICombinacionAtributosService.java │ │ │ ├── IRolService.java │ │ │ ├── IGrupoService.java │ │ │ ├── IEmpleadoService.java │ │ │ ├── IUbicacionService.java │ │ │ ├── IUnidadMedidaService.java │ │ │ ├── IEstatusOrdenService.java │ │ │ ├── IProveedorService.java │ │ │ ├── ITipoMovimientoService.java │ │ │ ├── IUsuarioService.java │ │ │ ├── IUsuarioAuthService.java │ │ │ ├── ICategoriaService.java │ │ │ ├── IAlmacenService.java │ │ │ ├── RolService.java │ │ │ ├── IAtributoService.java │ │ │ ├── IMarcaService.java │ │ │ ├── IValorAtributoService.java │ │ │ ├── UnidadMedidaService.java │ │ │ ├── EstatusOrdenService.java │ │ │ ├── TipoMovimientoService.java │ │ │ ├── IProductoService.java │ │ │ ├── GrupoService.java │ │ │ ├── UbicacionService.java │ │ │ └── CombinacionAtributosService.java │ │ │ ├── repository │ │ │ ├── IGrupoRepository.java │ │ │ ├── IVarianteRepository.java │ │ │ ├── IEmpleadoRepository.java │ │ │ ├── IUbicacionRepository.java │ │ │ ├── IInventarioRepository.java │ │ │ ├── IEstatusOrdenRepository.java │ │ │ ├── IUnidadMedidaRepository.java │ │ │ ├── ITipoMovimientoRepository.java │ │ │ ├── ICombinacionAtributosRepository.java │ │ │ ├── ICombinacionValorAtributoRepository.java │ │ │ ├── IAtributoRepository.java │ │ │ ├── IProveedorRepository.java │ │ │ ├── IValorAtributoRepository.java │ │ │ ├── IRolRepository.java │ │ │ ├── IMarcaRepository.java │ │ │ ├── IAlmacenRepository.java │ │ │ ├── IProductoRepository.java │ │ │ ├── IUsuarioRepository.java │ │ │ └── ICategoriaRepository.java │ │ │ ├── InventorySpringSecurityApplication.java │ │ │ ├── entity │ │ │ ├── Rol.java │ │ │ ├── TipoMovimiento.java │ │ │ ├── UnidadMedida.java │ │ │ ├── ValorAtributo.java │ │ │ ├── Grupo.java │ │ │ ├── Variante.java │ │ │ ├── Inventario.java │ │ │ ├── Ubicacion.java │ │ │ ├── Atributo.java │ │ │ ├── Usuario.java │ │ │ ├── DetalleOrdenCompra.java │ │ │ ├── CombinacionAtributos.java │ │ │ ├── CombinacionValorAtributo.java │ │ │ ├── InventarioProductoAtributos.java │ │ │ ├── Marca.java │ │ │ ├── EstatusOrden.java │ │ │ └── Proveedor.java │ │ │ ├── controller │ │ │ ├── DashboardController.java │ │ │ └── CombinacionAtributosController.java │ │ │ └── DataInitializer.java │ └── resources │ │ └── application.properties └── test │ └── java │ └── com │ └── inventory │ └── demo │ └── InventorySpringSecurityApplicationTests.java ├── .gitignore └── .mvn └── wrapper └── maven-wrapper.properties /doc/module-search-index.js: -------------------------------------------------------------------------------- 1 | moduleSearchIndex = [];updateSearchResults(); -------------------------------------------------------------------------------- /doc/resource-files/x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RodolfoBaume/InventoryBackend/main/doc/resource-files/x.png -------------------------------------------------------------------------------- /doc/resource-files/glass.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RodolfoBaume/InventoryBackend/main/doc/resource-files/glass.png -------------------------------------------------------------------------------- /doc/tag-search-index.js: -------------------------------------------------------------------------------- 1 | tagSearchIndex = [{"l":"Constant Field Values","h":"","u":"constant-values.html"}];updateSearchResults(); -------------------------------------------------------------------------------- /doc/element-list: -------------------------------------------------------------------------------- 1 | com.inventory 2 | com.inventory.controller 3 | com.inventory.demo 4 | com.inventory.dto 5 | com.inventory.entity 6 | com.inventory.projection 7 | com.inventory.repository 8 | com.inventory.security 9 | com.inventory.service 10 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/security/ConstantesSeguridad.java: -------------------------------------------------------------------------------- 1 | package com.inventory.security; 2 | 3 | public class ConstantesSeguridad { 4 | public static final long JWT_EXPIRATION_TOKEN = 2300000; 5 | public static final String JWT_FIRMA = "firma"; 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/dto/RolDto.java: -------------------------------------------------------------------------------- 1 | package com.inventory.dto; 2 | 3 | import com.inventory.entity.Rol; 4 | 5 | public record RolDto(Long idRol, String nombre) { 6 | public RolDto(Rol rol) { 7 | this(rol.getIdRol(), rol.getNombre()); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/dto/UnidadMedidaDto.java: -------------------------------------------------------------------------------- 1 | package com.inventory.dto; 2 | 3 | public record UnidadMedidaDto( 4 | long idUnidadMedida, 5 | String unidadMedida) { 6 | public UnidadMedidaDto(com.inventory.entity.UnidadMedida unidadMedida) { 7 | this(unidadMedida.getIdUnidadMedida(), unidadMedida.getUnidadMedida()); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /doc/package-search-index.js: -------------------------------------------------------------------------------- 1 | packageSearchIndex = [{"l":"All Packages","u":"allpackages-index.html"},{"l":"com.inventory.controller"},{"l":"com.inventory.demo"},{"l":"com.inventory.dto"},{"l":"com.inventory.entity"},{"l":"com.inventory.projection"},{"l":"com.inventory.repository"},{"l":"com.inventory.security"},{"l":"com.inventory.service"}];updateSearchResults(); -------------------------------------------------------------------------------- /src/main/java/com/inventory/service/ICombinacionAtributosService.java: -------------------------------------------------------------------------------- 1 | package com.inventory.service; 2 | 3 | import java.util.List; 4 | 5 | import com.inventory.entity.CombinacionAtributos; 6 | 7 | public interface ICombinacionAtributosService { 8 | 9 | CombinacionAtributos createCombinacion(Long grupoId, List valorAtributoIds); 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/test/java/com/inventory/demo/InventorySpringSecurityApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.inventory.demo; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class InventorySpringSecurityApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/repository/IGrupoRepository.java: -------------------------------------------------------------------------------- 1 | package com.inventory.repository; 2 | 3 | import org.springframework.data.jpa.repository.JpaRepository; 4 | import org.springframework.stereotype.Repository; 5 | 6 | import com.inventory.entity.Grupo; 7 | 8 | @Repository 9 | public interface IGrupoRepository extends JpaRepository { 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/repository/IVarianteRepository.java: -------------------------------------------------------------------------------- 1 | package com.inventory.repository; 2 | 3 | import org.springframework.data.jpa.repository.JpaRepository; 4 | import org.springframework.stereotype.Repository; 5 | 6 | import com.inventory.entity.Variante; 7 | 8 | @Repository 9 | public interface IVarianteRepository extends JpaRepository{ 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/repository/IEmpleadoRepository.java: -------------------------------------------------------------------------------- 1 | package com.inventory.repository; 2 | 3 | import org.springframework.data.jpa.repository.JpaRepository; 4 | import org.springframework.stereotype.Repository; 5 | 6 | import com.inventory.entity.Empleado; 7 | 8 | 9 | @Repository 10 | public interface IEmpleadoRepository extends JpaRepository{ 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/repository/IUbicacionRepository.java: -------------------------------------------------------------------------------- 1 | package com.inventory.repository; 2 | 3 | import org.springframework.data.jpa.repository.JpaRepository; 4 | import org.springframework.stereotype.Repository; 5 | 6 | import com.inventory.entity.Ubicacion; 7 | 8 | @Repository 9 | public interface IUbicacionRepository extends JpaRepository{ 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/dto/EstatusOrdenDto.java: -------------------------------------------------------------------------------- 1 | package com.inventory.dto; 2 | 3 | import com.inventory.entity.EstatusOrden; 4 | 5 | public record EstatusOrdenDto( 6 | long idEstatusOrden, 7 | String estatusOrden 8 | ) { 9 | 10 | public EstatusOrdenDto(EstatusOrden estatusOrden) { 11 | this(estatusOrden.getIdEstatusOrden(), estatusOrden.getEstatusOrden()); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/repository/IInventarioRepository.java: -------------------------------------------------------------------------------- 1 | package com.inventory.repository; 2 | 3 | import org.springframework.data.jpa.repository.JpaRepository; 4 | import org.springframework.stereotype.Repository; 5 | 6 | import com.inventory.entity.Inventario; 7 | 8 | @Repository 9 | public interface IInventarioRepository extends JpaRepository{ 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/dto/ValorAtributoDto.java: -------------------------------------------------------------------------------- 1 | package com.inventory.dto; 2 | 3 | import com.inventory.entity.ValorAtributo; 4 | 5 | public record ValorAtributoDto( 6 | Long idValorAtributo, 7 | String valor 8 | ) { 9 | public ValorAtributoDto(ValorAtributo valorAtributo) { 10 | this(valorAtributo.getIdValorAtributo(), valorAtributo.getValor()); 11 | } 12 | } -------------------------------------------------------------------------------- /src/main/java/com/inventory/repository/IEstatusOrdenRepository.java: -------------------------------------------------------------------------------- 1 | package com.inventory.repository; 2 | 3 | import org.springframework.data.jpa.repository.JpaRepository; 4 | import org.springframework.stereotype.Repository; 5 | 6 | import com.inventory.entity.EstatusOrden; 7 | 8 | @Repository 9 | public interface IEstatusOrdenRepository extends JpaRepository{ 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/repository/IUnidadMedidaRepository.java: -------------------------------------------------------------------------------- 1 | package com.inventory.repository; 2 | 3 | import org.springframework.data.jpa.repository.JpaRepository; 4 | import org.springframework.stereotype.Repository; 5 | 6 | import com.inventory.entity.UnidadMedida; 7 | 8 | @Repository 9 | public interface IUnidadMedidaRepository extends JpaRepository{ 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/dto/TipoMovimientoDto.java: -------------------------------------------------------------------------------- 1 | package com.inventory.dto; 2 | 3 | import com.inventory.entity.TipoMovimiento; 4 | 5 | public record TipoMovimientoDto( 6 | long idTipoMovimiento, 7 | String tipoMovimiento 8 | ) { 9 | public TipoMovimientoDto(TipoMovimiento tipoMovimiento) { 10 | this(tipoMovimiento.getIdTipoMovimiento(), tipoMovimiento.getTipoMovimiento()); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/repository/ITipoMovimientoRepository.java: -------------------------------------------------------------------------------- 1 | package com.inventory.repository; 2 | 3 | import org.springframework.data.jpa.repository.JpaRepository; 4 | import org.springframework.stereotype.Repository; 5 | 6 | import com.inventory.entity.TipoMovimiento; 7 | 8 | @Repository 9 | public interface ITipoMovimientoRepository extends JpaRepository{ 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/repository/ICombinacionAtributosRepository.java: -------------------------------------------------------------------------------- 1 | package com.inventory.repository; 2 | 3 | import org.springframework.data.jpa.repository.JpaRepository; 4 | import org.springframework.stereotype.Repository; 5 | 6 | import com.inventory.entity.CombinacionAtributos; 7 | 8 | @Repository 9 | public interface ICombinacionAtributosRepository extends JpaRepository{ 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/dto/UsuarioDto.java: -------------------------------------------------------------------------------- 1 | package com.inventory.dto; 2 | 3 | import java.util.List; 4 | 5 | import com.inventory.entity.Rol; 6 | import com.inventory.entity.Usuario; 7 | 8 | public record UsuarioDto(long idUsuario, String username, String password, Listrol) { 9 | public UsuarioDto(Usuario usuario) { 10 | this(usuario.getIdUsuario(), usuario.getUsername(), usuario.getPassword(), usuario.getRol()); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/repository/ICombinacionValorAtributoRepository.java: -------------------------------------------------------------------------------- 1 | package com.inventory.repository; 2 | 3 | import org.springframework.data.jpa.repository.JpaRepository; 4 | import org.springframework.stereotype.Repository; 5 | 6 | import com.inventory.entity.CombinacionValorAtributo; 7 | 8 | @Repository 9 | public interface ICombinacionValorAtributoRepository extends JpaRepository{ 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/InventorySpringSecurityApplication.java: -------------------------------------------------------------------------------- 1 | package com.inventory; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class InventorySpringSecurityApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(InventorySpringSecurityApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/repository/IAtributoRepository.java: -------------------------------------------------------------------------------- 1 | package com.inventory.repository; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.data.jpa.repository.JpaRepository; 6 | import org.springframework.stereotype.Repository; 7 | 8 | import com.inventory.entity.Atributo; 9 | 10 | @Repository 11 | public interface IAtributoRepository extends JpaRepository { 12 | 13 | List findByGrupo_IdGrupo(Long grupoId); 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/repository/IProveedorRepository.java: -------------------------------------------------------------------------------- 1 | package com.inventory.repository; 2 | 3 | import org.springframework.data.jpa.repository.JpaRepository; 4 | import org.springframework.stereotype.Repository; 5 | 6 | import com.inventory.entity.Proveedor; 7 | 8 | @Repository 9 | public interface IProveedorRepository extends JpaRepository{ 10 | // Método derivado para contar proveedores sin borrado logico 11 | long countByDeletedFalse(); 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/repository/IValorAtributoRepository.java: -------------------------------------------------------------------------------- 1 | package com.inventory.repository; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.data.jpa.repository.JpaRepository; 6 | import org.springframework.stereotype.Repository; 7 | 8 | import com.inventory.entity.ValorAtributo; 9 | 10 | @Repository 11 | public interface IValorAtributoRepository extends JpaRepository{ 12 | 13 | List findByAtributo_IdAtributo(Long atributoId); 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/repository/IRolRepository.java: -------------------------------------------------------------------------------- 1 | package com.inventory.repository; 2 | 3 | import java.util.Optional; 4 | 5 | import org.springframework.data.jpa.repository.JpaRepository; 6 | import org.springframework.stereotype.Repository; 7 | 8 | import com.inventory.entity.Rol; 9 | 10 | @Repository 11 | public interface IRolRepository extends JpaRepository { 12 | // Método para buscar un role por su nombre en nuestra base de datos 13 | Optional findByNombre(String nombre); 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/dto/UbicacionDto.java: -------------------------------------------------------------------------------- 1 | package com.inventory.dto; 2 | 3 | import com.inventory.entity.Ubicacion; 4 | 5 | public record UbicacionDto( 6 | long idUbicacion, 7 | String nombreUbicacion, 8 | String direccionUbicacion, 9 | String telefono, 10 | String responsable 11 | ) { 12 | public UbicacionDto(Ubicacion ubicacion) { 13 | this(ubicacion.getIdUbicacion(), ubicacion.getNombreUbicacion(), ubicacion.getDireccionUbicacion(), ubicacion.getTelefono(), ubicacion.getResponsable()); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/repository/IMarcaRepository.java: -------------------------------------------------------------------------------- 1 | package com.inventory.repository; 2 | 3 | import org.springframework.data.jpa.repository.JpaRepository; 4 | import org.springframework.stereotype.Repository; 5 | 6 | import com.inventory.entity.Marca; 7 | 8 | /** 9 | * Repositorio para realizar operaciones CRUD en la entidad {@link Marca}. 10 | * Extiende {@link JpaRepository} para heredar métodos de acceso a datos comunes. 11 | */ 12 | @Repository 13 | public interface IMarcaRepository extends JpaRepository { 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/dto/ProductosDto.java: -------------------------------------------------------------------------------- 1 | package com.inventory.dto; 2 | 3 | import com.inventory.entity.Producto; 4 | 5 | public record ProductosDto( 6 | long idProducto, 7 | String nombreProducto, 8 | double precio, 9 | int cantidad 10 | ) { 11 | public ProductosDto(Producto producto) { 12 | this( 13 | producto.getIdProducto(), 14 | producto.getNombreProducto(), 15 | producto.getPrecio(), 16 | producto.getCantidad() 17 | ); 18 | } 19 | } 20 | 21 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/**/target/ 5 | !**/src/test/**/target/ 6 | !doc/ 7 | 8 | ### STS ### 9 | .apt_generated 10 | .classpath 11 | .factorypath 12 | .project 13 | .settings 14 | .springBeans 15 | .sts4-cache 16 | 17 | ### IntelliJ IDEA ### 18 | .idea 19 | *.iws 20 | *.iml 21 | *.ipr 22 | 23 | ### NetBeans ### 24 | /nbproject/private/ 25 | /nbbuild/ 26 | /dist/ 27 | /nbdist/ 28 | /.nb-gradle/ 29 | build/ 30 | !**/src/main/**/build/ 31 | !**/src/test/**/build/ 32 | 33 | ### VS Code ### 34 | .vscode/ 35 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/dto/ProveedorDto.java: -------------------------------------------------------------------------------- 1 | package com.inventory.dto; 2 | 3 | import com.inventory.entity.Proveedor; 4 | 5 | public record ProveedorDto( 6 | long idProveedor, 7 | String nombreProveedor, 8 | String direccionProveedor, 9 | String telefonoProveedor, 10 | String emailProveedor, 11 | boolean deleted 12 | ) { 13 | public ProveedorDto(Proveedor proveedor) { 14 | this(proveedor.getIdProveedor(), proveedor.getNombreProveedor(), proveedor.getDireccionProveedor(), proveedor.getTelefonoProveedor(), proveedor.getEmailProveedor(), proveedor.isDeleted()); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/service/IRolService.java: -------------------------------------------------------------------------------- 1 | package com.inventory.service; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.data.domain.Page; 6 | import org.springframework.data.domain.Pageable; 7 | 8 | import com.inventory.dto.RolDto; 9 | import com.inventory.entity.Rol; 10 | 11 | 12 | public interface IRolService { 13 | 14 | List findAll(); 15 | 16 | Page findAllPage(Pageable pageable); 17 | 18 | Rol findById(Long idRol); 19 | 20 | Rol createRol(RolDto rol); 21 | 22 | Rol deleteRol(Long idRol); 23 | 24 | Rol updateRol(Long idRol, RolDto rol); 25 | } 26 | -------------------------------------------------------------------------------- /src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.datasource.url=jdbc:postgresql://localhost:5432/inventory 2 | spring.datasource.username=postgres 3 | spring.datasource.password=12345 4 | spring.datasource.hikari.connection-timeout=20000 5 | spring.datasource.hikari.maximum-pool-size=5 6 | spring.jpa.show-sql=true 7 | spring.jpa.hibernate.ddl-auto=update 8 | spring.datasource.driver-class-name=org.postgresql.Driver 9 | logging.level.org.hibernate.SQL=debug 10 | 11 | springdoc.swagger-ui.operationsSorter=method 12 | 13 | # /api-docs endpoint custom path 14 | springdoc.api-docs.path=/api-docs 15 | springdoc.swagger-ui.path=/swagger-ui.html -------------------------------------------------------------------------------- /src/main/java/com/inventory/dto/AtributoDto.java: -------------------------------------------------------------------------------- 1 | package com.inventory.dto; 2 | 3 | import java.util.List; 4 | 5 | import com.inventory.entity.Atributo; 6 | 7 | public record AtributoDto( 8 | long idAtributo, 9 | String atributo, 10 | List valores 11 | ) { 12 | public AtributoDto(Atributo atributo) { 13 | this( 14 | atributo.getIdAtributo(), 15 | atributo.getAtributo(), 16 | atributo.getValores() == null ? List.of() : atributo.getValores().stream() 17 | .map(ValorAtributoDto::new) 18 | .toList() 19 | ); 20 | } 21 | } -------------------------------------------------------------------------------- /src/main/java/com/inventory/dto/CategoriaProductoDto.java: -------------------------------------------------------------------------------- 1 | package com.inventory.dto; 2 | 3 | import java.util.List; 4 | 5 | import com.inventory.entity.Categoria; 6 | 7 | public record CategoriaProductoDto( 8 | long idCategoria, 9 | String nombreCategoria, 10 | List productos 11 | ) { 12 | public CategoriaProductoDto(Categoria categoria) { 13 | this( 14 | categoria.getIdCategoria(), 15 | categoria.getNombreCategoria(), 16 | categoria.getProductos().stream() 17 | .map(ProductosDto::new) 18 | .toList() 19 | ); 20 | } 21 | } -------------------------------------------------------------------------------- /src/main/java/com/inventory/repository/IAlmacenRepository.java: -------------------------------------------------------------------------------- 1 | package com.inventory.repository; 2 | 3 | import org.springframework.data.jpa.repository.JpaRepository; 4 | import org.springframework.stereotype.Repository; 5 | 6 | import com.inventory.entity.Almacen; 7 | 8 | /** 9 | * Repositorio para gestionar las operaciones CRUD de la entidad {@link Almacen}. 10 | * 11 | * Esta interfaz extiende {@link JpaRepository}, lo que permite realizar operaciones 12 | * de base de datos sobre la tabla 'almacenes' sin necesidad de implementar métodos manualmente. 13 | */ 14 | @Repository 15 | public interface IAlmacenRepository extends JpaRepository{ 16 | 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/dto/GrupoDto.java: -------------------------------------------------------------------------------- 1 | package com.inventory.dto; 2 | 3 | import java.util.List; 4 | 5 | import com.inventory.entity.Grupo; 6 | 7 | public record GrupoDto( 8 | long idGrupo, 9 | String nombreGrupo, 10 | Boolean status, 11 | List atributos 12 | ) { 13 | public GrupoDto(Grupo grupo) { 14 | this( 15 | grupo.getIdGrupo(), 16 | grupo.getNombreGrupo(), 17 | grupo.getStatus(), 18 | grupo.getAtributos() == null ? List.of() : grupo.getAtributos().stream() 19 | .map(AtributoDto::new) 20 | .toList() 21 | ); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/dto/RegistroResponseDto.java: -------------------------------------------------------------------------------- 1 | package com.inventory.dto; 2 | 3 | 4 | public class RegistroResponseDto { 5 | 6 | private String mensaje; 7 | private Long idUsuario; 8 | 9 | public RegistroResponseDto(String mensaje, Long idUsuario) { 10 | this.mensaje = mensaje; 11 | this.idUsuario = idUsuario; 12 | } 13 | 14 | public String getMensaje() { 15 | return mensaje; 16 | } 17 | 18 | public void setMensaje(String mensaje) { 19 | this.mensaje = mensaje; 20 | } 21 | 22 | public Long getIdUsuario() { 23 | return idUsuario; 24 | } 25 | 26 | public void setIdUsuario(Long idUsuario) { 27 | this.idUsuario = idUsuario; 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/service/IGrupoService.java: -------------------------------------------------------------------------------- 1 | package com.inventory.service; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.data.domain.Page; 6 | import org.springframework.data.domain.Pageable; 7 | 8 | import com.inventory.dto.GrupoDto; 9 | import com.inventory.entity.Grupo; 10 | 11 | public interface IGrupoService { 12 | 13 | List findAll(); 14 | 15 | Page findAllPage(Pageable pageable); 16 | 17 | Grupo findById(Long idGrupo); 18 | 19 | Grupo createGrupo(GrupoDto grupo); 20 | 21 | Grupo deleteGrupo(Long idGrupo); 22 | 23 | Grupo updateGrupo(Long idGrupo, GrupoDto grupo); 24 | 25 | GrupoDto obtenerGrupoCompleto(Long idGrupo); 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/dto/LoginDto.java: -------------------------------------------------------------------------------- 1 | package com.inventory.dto; 2 | 3 | public class LoginDto { 4 | private String username; 5 | private String password; 6 | 7 | public LoginDto() { 8 | super(); 9 | } 10 | 11 | public LoginDto(String username, String password) { 12 | super(); 13 | this.username = username; 14 | this.password = password; 15 | } 16 | 17 | public String getUsername() { 18 | return username; 19 | } 20 | 21 | public void setUsername(String username) { 22 | this.username = username; 23 | } 24 | 25 | public String getPassword() { 26 | return password; 27 | } 28 | 29 | public void setPassword(String password) { 30 | this.password = password; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/service/IEmpleadoService.java: -------------------------------------------------------------------------------- 1 | package com.inventory.service; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.data.domain.Page; 6 | import org.springframework.data.domain.Pageable; 7 | 8 | import com.inventory.dto.EmpleadoDto; 9 | import com.inventory.entity.Empleado; 10 | 11 | 12 | public interface IEmpleadoService { 13 | 14 | List findAll(); 15 | 16 | Page findAllPage(Pageable pageable); 17 | 18 | Empleado findById(Long idEmpleado); 19 | 20 | Empleado createEmpleado(EmpleadoDto empleado, Long idUsuario); 21 | 22 | Empleado deleteEmpleado(Long idEmpleado); 23 | 24 | Empleado updateEmpleado(Long idEmpleado, EmpleadoDto empleado); 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/dto/AlmacenDto.java: -------------------------------------------------------------------------------- 1 | package com.inventory.dto; 2 | 3 | import com.inventory.entity.Almacen; 4 | 5 | /** 6 | * DTO para la transferencia de datos de la entidad {@link Almacen}. 7 | */ 8 | public record AlmacenDto( 9 | long idAlmacen, 10 | String nombreAlmacen, 11 | String direccionAlmacen, 12 | String telefonoAlmacen, 13 | String responsableAlmacen 14 | ) { 15 | /** 16 | * Constructor que inicializa un AlmacenDto a partir de un objeto Almacen. 17 | * 18 | */ 19 | public AlmacenDto(Almacen almacen) { 20 | this(almacen.getIdAlmacen(), almacen.getNombreAlmacen(), almacen.getDireccionAlmacen(), almacen.getTelefonoAlmacen(), almacen.getResponsableAlmacen()); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/dto/RegistroUsuarioEmpleadoDto.java: -------------------------------------------------------------------------------- 1 | package com.inventory.dto; 2 | 3 | public class RegistroUsuarioEmpleadoDto { 4 | private UsuarioDto usuario; 5 | private EmpleadoDto empleado; 6 | 7 | public RegistroUsuarioEmpleadoDto(UsuarioDto usuario, EmpleadoDto empleado) { 8 | super(); 9 | this.usuario = usuario; 10 | this.empleado = empleado; 11 | } 12 | 13 | public UsuarioDto getUsuario() { 14 | return usuario; 15 | } 16 | 17 | public void setUsuario(UsuarioDto usuario) { 18 | this.usuario = usuario; 19 | } 20 | 21 | public EmpleadoDto getEmpleado() { 22 | return empleado; 23 | } 24 | 25 | public void setEmpleado(EmpleadoDto empleado) { 26 | this.empleado = empleado; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/service/IUbicacionService.java: -------------------------------------------------------------------------------- 1 | package com.inventory.service; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.data.domain.Page; 6 | import org.springframework.data.domain.Pageable; 7 | 8 | import com.inventory.dto.UbicacionDto; 9 | import com.inventory.entity.Ubicacion; 10 | 11 | public interface IUbicacionService { 12 | 13 | List findAll(); 14 | 15 | Page findAllPage(Pageable pageable); 16 | 17 | Ubicacion findById(Long idUbicacion); 18 | 19 | Ubicacion createUbicacion(UbicacionDto ubicacion); 20 | 21 | Ubicacion deleteUbicacion(Long idUbicacion); 22 | 23 | Ubicacion updateUbicacion(Long idUbicacion, UbicacionDto ubicacion); 24 | 25 | long countUbicaciones(); 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/dto/EmpleadoDto.java: -------------------------------------------------------------------------------- 1 | package com.inventory.dto; 2 | 3 | import com.inventory.entity.Empleado; 4 | import com.inventory.entity.Usuario; 5 | 6 | public record EmpleadoDto( 7 | long idEmpleado, 8 | String nombre, 9 | String apellidoPaterno, 10 | String apellidoMaterno, 11 | long nss, 12 | String curp, 13 | String rfc, 14 | String puesto, 15 | String observaciones, 16 | Usuario usuario) { 17 | 18 | public EmpleadoDto(Empleado empleado) { 19 | this(empleado.getIdEmpleado(), empleado.getNombre(), empleado.getApellidoPaterno(), empleado.getApellidoMaterno(), empleado.getNss(), empleado.getCurp(), empleado.getRfc(), empleado.getPuesto(), empleado.getObservaciones(), empleado.getUsuario() ); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/dto/AuthRespuestaDto.java: -------------------------------------------------------------------------------- 1 | package com.inventory.dto; 2 | 3 | // Devuelve token y tipo 4 | public class AuthRespuestaDto { 5 | private String accessToken; 6 | private String tokenType = "Bearer "; 7 | 8 | public AuthRespuestaDto(String accessToken) { 9 | this.accessToken = accessToken; 10 | } 11 | 12 | 13 | 14 | public AuthRespuestaDto() { 15 | } 16 | 17 | 18 | 19 | public String getAccessToken() { 20 | return accessToken; 21 | } 22 | 23 | public void setAccessToken(String accessToken) { 24 | this.accessToken = accessToken; 25 | } 26 | 27 | public String getTokenType() { 28 | return tokenType; 29 | } 30 | 31 | public void setTokenType(String tokenType) { 32 | this.tokenType = tokenType; 33 | } 34 | 35 | 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/service/IUnidadMedidaService.java: -------------------------------------------------------------------------------- 1 | package com.inventory.service; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.data.domain.Page; 6 | import org.springframework.data.domain.Pageable; 7 | 8 | import com.inventory.dto.UnidadMedidaDto; 9 | import com.inventory.entity.UnidadMedida; 10 | 11 | public interface IUnidadMedidaService { 12 | 13 | ListfindAll(); 14 | 15 | Page findAllPage(Pageable pageable); 16 | 17 | UnidadMedida findById(Long idUnidadMedida); 18 | 19 | UnidadMedida createUnidadMedida(UnidadMedidaDto unidadMedida); 20 | 21 | UnidadMedida deleteUnidadMedida(Long idUnidadMedida); 22 | 23 | UnidadMedida updateUnidadMedida(Long idUnidadMedida, UnidadMedidaDto unidadMedida); 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/service/IEstatusOrdenService.java: -------------------------------------------------------------------------------- 1 | package com.inventory.service; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.data.domain.Page; 6 | import org.springframework.data.domain.Pageable; 7 | 8 | import com.inventory.dto.EstatusOrdenDto; 9 | import com.inventory.entity.EstatusOrden; 10 | 11 | public interface IEstatusOrdenService { 12 | 13 | List findAll(); 14 | 15 | Page findAllPage(Pageable pageable); 16 | 17 | EstatusOrden findById(Long idEstatusOrden); 18 | 19 | EstatusOrden createEstatusOrden(EstatusOrdenDto estatusOrden); 20 | 21 | EstatusOrden deleteEstatusOrden(Long idEstatusOrden); 22 | 23 | EstatusOrden updateEstatusOrden(Long idEstatusOrden, EstatusOrdenDto estatusOrden); 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/dto/MarcaDto.java: -------------------------------------------------------------------------------- 1 | package com.inventory.dto; 2 | 3 | import com.inventory.entity.Marca; 4 | 5 | /** 6 | * DTO para la entidad {@link Marca}. 7 | * Se utiliza para transferir datos de Marca entre capas de la aplicación. 8 | * 9 | * Atributos: 10 | * - {@link #idMarca}: Identificador de la marca. 11 | * - {@link #marca}: Nombre de la marca. 12 | */ 13 | public record MarcaDto( 14 | long idMarca, 15 | String marca 16 | ) { 17 | 18 | /** 19 | * Constructor que permite crear una instancia de MarcaDto desde una entidad Marca. 20 | * 21 | * @param marca la entidad Marca de la cual se copiarán los datos. 22 | */ 23 | public MarcaDto(Marca marca) { 24 | this(marca.getIdMarca(), marca.getMarca()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/service/IProveedorService.java: -------------------------------------------------------------------------------- 1 | package com.inventory.service; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.data.domain.Page; 6 | import org.springframework.data.domain.Pageable; 7 | 8 | import com.inventory.dto.ProveedorDto; 9 | import com.inventory.entity.Proveedor; 10 | 11 | public interface IProveedorService { 12 | List findAll(boolean isDeleted); 13 | 14 | Page findAllPage(Pageable pageable, boolean isDeleted); 15 | 16 | Proveedor findById(Long idCliente, boolean isDeleted); 17 | 18 | Proveedor createProveedor(ProveedorDto proveedor); 19 | 20 | Proveedor deleteProveedor(Long idProveedor); 21 | 22 | Proveedor updateProveedor(Long idProveedor, ProveedorDto proveedor); 23 | 24 | long countProveedores(); 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/repository/IProductoRepository.java: -------------------------------------------------------------------------------- 1 | package com.inventory.repository; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.data.jpa.repository.JpaRepository; 6 | import org.springframework.data.jpa.repository.Query; 7 | import org.springframework.data.repository.query.Param; 8 | import org.springframework.stereotype.Repository; 9 | 10 | import com.inventory.entity.Producto; 11 | 12 | @Repository 13 | public interface IProductoRepository extends JpaRepository{ 14 | /* 15 | @Query("SELECT p FROM Producto p " + 16 | "JOIN p.tipoProducto tp " + 17 | "JOIN tp.categoria c " + 18 | "WHERE c.idCategoria = :idCategoria") 19 | List obtenerProductosPorCategoriaId(@Param("idCategoria") Long idCategoria); 20 | */ 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/service/ITipoMovimientoService.java: -------------------------------------------------------------------------------- 1 | package com.inventory.service; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.data.domain.Page; 6 | import org.springframework.data.domain.Pageable; 7 | 8 | import com.inventory.dto.TipoMovimientoDto; 9 | import com.inventory.entity.TipoMovimiento; 10 | 11 | public interface ITipoMovimientoService { 12 | 13 | List findAll(); 14 | 15 | Page findAllPage(Pageable pageable); 16 | 17 | TipoMovimiento findById(Long idTipoMovimiento); 18 | 19 | TipoMovimiento createTipoMovimiento(TipoMovimientoDto tipoMovimiento); 20 | 21 | TipoMovimiento deleteTipoMovimiento(Long idTipoMovimiento); 22 | 23 | TipoMovimiento updateTipoMovimiento(Long idTipoMovimiento, TipoMovimientoDto tipoMovimiento); 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/service/IUsuarioService.java: -------------------------------------------------------------------------------- 1 | package com.inventory.service; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.data.domain.Page; 6 | import org.springframework.data.domain.Pageable; 7 | import org.springframework.http.ResponseEntity; 8 | 9 | import com.inventory.dto.RegistroResponseDto; 10 | import com.inventory.dto.UsuarioDto; 11 | import com.inventory.entity.Usuario; 12 | 13 | 14 | public interface IUsuarioService { 15 | 16 | List findAll(); 17 | 18 | Page findAllPage(Pageable pageable); 19 | 20 | Usuario findById(Long idUsuario); 21 | 22 | ResponseEntity registrarUsuario(UsuarioDto dtoRegistro, String role); 23 | 24 | Usuario deleteUsuario(Long idUsuario); 25 | 26 | Usuario updateUsuario(Long idUsuario, UsuarioDto usuario); 27 | 28 | 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/service/IUsuarioAuthService.java: -------------------------------------------------------------------------------- 1 | package com.inventory.service; 2 | 3 | import java.security.Principal; 4 | 5 | import org.springframework.http.ResponseEntity; 6 | 7 | import com.inventory.dto.AuthRespuestaDto; 8 | import com.inventory.dto.LoginDto; 9 | import com.inventory.dto.PasswordDto; 10 | import com.inventory.dto.RegistroResponseDto; 11 | import com.inventory.dto.UsuarioActualDto; 12 | import com.inventory.dto.UsuarioDto; 13 | 14 | public interface IUsuarioAuthService { 15 | 16 | ResponseEntity registrarUsuario(UsuarioDto registroDto, String role); 17 | 18 | ResponseEntity login(LoginDto dtoLogin); 19 | 20 | ResponseEntity obtenerUsuarioActual(Principal principal); 21 | 22 | ResponseEntity cambiarPassword(Principal principal, PasswordDto passwordDto); 23 | 24 | 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/dto/PasswordDto.java: -------------------------------------------------------------------------------- 1 | package com.inventory.dto; 2 | 3 | public class PasswordDto { 4 | private String currentPassword; 5 | private String newPassword; 6 | 7 | public PasswordDto() { 8 | super(); 9 | } 10 | 11 | 12 | public PasswordDto(String currentPassword, String newPassword) { 13 | super(); 14 | this.currentPassword = currentPassword; 15 | this.newPassword = newPassword; 16 | } 17 | 18 | 19 | public String getCurrentPassword() { 20 | return currentPassword; 21 | } 22 | 23 | 24 | public void setCurrentPassword(String currentPassword) { 25 | this.currentPassword = currentPassword; 26 | } 27 | 28 | 29 | public String getNewPassword() { 30 | return newPassword; 31 | } 32 | 33 | 34 | public void setNewPassword(String newPassword) { 35 | this.newPassword = newPassword; 36 | } 37 | 38 | 39 | 40 | 41 | 42 | 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/security/JwtAuthenticationEntryPoint.java: -------------------------------------------------------------------------------- 1 | package com.inventory.security; 2 | 3 | import java.io.IOException; 4 | 5 | import org.springframework.security.core.AuthenticationException; 6 | import org.springframework.security.web.AuthenticationEntryPoint; 7 | import org.springframework.stereotype.Component; 8 | 9 | import jakarta.servlet.ServletException; 10 | import jakarta.servlet.http.HttpServletRequest; 11 | import jakarta.servlet.http.HttpServletResponse; 12 | 13 | // Clase para poder manejar las excepciones de tipo autenticación en nuestra app 14 | @Component 15 | public class JwtAuthenticationEntryPoint implements AuthenticationEntryPoint{ 16 | 17 | @Override 18 | public void commence(HttpServletRequest request, HttpServletResponse response, 19 | AuthenticationException authException) throws IOException, ServletException { 20 | response.sendError(HttpServletResponse.SC_UNAUTHORIZED, authException.getMessage()); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/service/ICategoriaService.java: -------------------------------------------------------------------------------- 1 | package com.inventory.service; 2 | 3 | import java.util.List; 4 | 5 | import com.inventory.dto.CategoriaDto; 6 | import com.inventory.dto.CategoriaProductoDto; 7 | 8 | public interface ICategoriaService { 9 | 10 | List obtenerCategoriasEnArbol(); 11 | 12 | CategoriaDto obtenerCategoriaPorId(Long id); 13 | 14 | CategoriaDto crearCategoria(CategoriaDto categoriaDto); 15 | 16 | CategoriaDto actualizarCategoria(Long id, CategoriaDto categoriaDto); 17 | 18 | void eliminarCategoria(Long id); 19 | 20 | //List obtenerCategoriasConProductos(); 21 | 22 | //Optional obtenerCategoriaConProductosPorId(Long idCategoria); 23 | 24 | //List obtenerProductosPorCategoriaId(Long idCategoria); 25 | CategoriaProductoDto obtenerProductosPorCategoria(Long idCategoria); 26 | 27 | //breadcrumb 28 | List obtenerJerarquiaPorId(Long idCategoria); 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/entity/Rol.java: -------------------------------------------------------------------------------- 1 | package com.inventory.entity; 2 | 3 | import jakarta.persistence.Column; 4 | import jakarta.persistence.Entity; 5 | import jakarta.persistence.GeneratedValue; 6 | import jakarta.persistence.GenerationType; 7 | import jakarta.persistence.Id; 8 | import jakarta.persistence.Table; 9 | 10 | @Entity 11 | @Table(name = "roles") 12 | public class Rol { 13 | @Id 14 | @GeneratedValue(strategy = GenerationType.IDENTITY) 15 | @Column(name = "id_rol") 16 | private Long idRol; 17 | private String nombre; 18 | 19 | public Rol() { 20 | super(); 21 | } 22 | 23 | public Rol(Long idRol, String nombre) { 24 | super(); 25 | this.idRol = idRol; 26 | this.nombre = nombre; 27 | } 28 | 29 | public Long getIdRol() { 30 | return idRol; 31 | } 32 | 33 | public void setIdRol(Long idRol) { 34 | this.idRol = idRol; 35 | } 36 | 37 | public String getNombre() { 38 | return nombre; 39 | } 40 | 41 | public void setNombre(String nombre) { 42 | this.nombre = nombre; 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one 2 | # or more contributor license agreements. See the NOTICE file 3 | # distributed with this work for additional information 4 | # regarding copyright ownership. The ASF licenses this file 5 | # to you under the Apache License, Version 2.0 (the 6 | # "License"); you may not use this file except in compliance 7 | # with the License. You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, 12 | # software distributed under the License is distributed on an 13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | # KIND, either express or implied. See the License for the 15 | # specific language governing permissions and limitations 16 | # under the License. 17 | wrapperVersion=3.3.2 18 | distributionType=only-script 19 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip 20 | -------------------------------------------------------------------------------- /doc/overview-summary.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Generated Documentation (Untitled) 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 |
20 | 23 |

index.html

24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/repository/IUsuarioRepository.java: -------------------------------------------------------------------------------- 1 | package com.inventory.repository; 2 | 3 | import java.util.Optional; 4 | 5 | import org.springframework.data.jpa.repository.JpaRepository; 6 | import org.springframework.data.jpa.repository.Modifying; 7 | import org.springframework.data.jpa.repository.Query; 8 | import org.springframework.stereotype.Repository; 9 | 10 | import com.inventory.entity.Usuario; 11 | 12 | @Repository 13 | public interface IUsuarioRepository extends JpaRepository { 14 | // Método para poder buscar un usuario mediante su nombre 15 | Optional findByUsername(String username); 16 | 17 | // Método para poder verificar si un usuario existe en nuestra base de datos 18 | Boolean existsByUsername(String username); 19 | 20 | @Query(value = "SELECT * From usuarios where username = ?1", nativeQuery = true) 21 | Usuario findCustomerByUsername(String username); 22 | 23 | @Modifying(clearAutomatically = true) 24 | @Query(value = "UPDATE usuarios SET password=?1 where username = ?2", nativeQuery = true) 25 | void setPassword(String password, String username); 26 | 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/dto/CategoriaDto.java: -------------------------------------------------------------------------------- 1 | package com.inventory.dto; 2 | 3 | import java.util.List; 4 | 5 | import com.inventory.entity.Categoria; 6 | 7 | public record CategoriaDto( 8 | Long idCategoria, 9 | String nombreCategoria, 10 | String descripcionCategoria, 11 | Boolean folder, 12 | Long parentId, 13 | List subcategorias 14 | ) { 15 | /** 16 | * Constructor que inicializa un CategoriaDto a partir de un objeto Categoria. 17 | * 18 | * @param categoria entidad Categoria para crear el DTO 19 | */ 20 | public CategoriaDto(Categoria categoria) { 21 | this( 22 | categoria.getIdCategoria(), 23 | categoria.getNombreCategoria(), 24 | categoria.getDescripcionCategoria(), 25 | categoria.getFolder(), 26 | categoria.getParent() != null ? categoria.getParent().getIdCategoria() : null, 27 | categoria.getSubcategorias() != null ? 28 | categoria.getSubcategorias().stream() 29 | .map(CategoriaDto::new) 30 | .toList() 31 | : List.of() 32 | ); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/entity/TipoMovimiento.java: -------------------------------------------------------------------------------- 1 | package com.inventory.entity; 2 | 3 | import jakarta.persistence.Column; 4 | import jakarta.persistence.Entity; 5 | import jakarta.persistence.GeneratedValue; 6 | import jakarta.persistence.GenerationType; 7 | import jakarta.persistence.Id; 8 | import jakarta.persistence.Table; 9 | 10 | @Entity 11 | @Table(name="tipos_movimiento") 12 | public class TipoMovimiento { 13 | @Id 14 | @GeneratedValue(strategy = GenerationType.IDENTITY) 15 | @Column(name = "id_tipo_movimiento") 16 | private long idTipoMovimiento; 17 | private String tipoMovimiento; 18 | 19 | public TipoMovimiento() { 20 | super(); 21 | } 22 | 23 | public TipoMovimiento(long idTipoMovimiento, String tipoMovimiento) { 24 | super(); 25 | this.idTipoMovimiento = idTipoMovimiento; 26 | this.tipoMovimiento = tipoMovimiento; 27 | } 28 | 29 | public long getIdTipoMovimiento() { 30 | return idTipoMovimiento; 31 | } 32 | 33 | public void setIdTipoMovimiento(long idTipoMovimiento) { 34 | this.idTipoMovimiento = idTipoMovimiento; 35 | } 36 | 37 | public String getTipoMovimiento() { 38 | return tipoMovimiento; 39 | } 40 | 41 | public void setTipoMovimiento(String tipoMovimiento) { 42 | this.tipoMovimiento = tipoMovimiento; 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/dto/UsuarioActualDto.java: -------------------------------------------------------------------------------- 1 | package com.inventory.dto; 2 | 3 | public class UsuarioActualDto { 4 | private String username; 5 | private String password; 6 | private String role; 7 | private Long idCliente; 8 | private Long idEmpleado; 9 | 10 | public UsuarioActualDto() { 11 | super(); 12 | } 13 | 14 | 15 | public UsuarioActualDto(String username, String password, String role) { 16 | super(); 17 | this.username = username; 18 | this.password = password; 19 | this.role = role; 20 | } 21 | 22 | 23 | public String getUsername() { 24 | return username; 25 | } 26 | 27 | 28 | public void setUsername(String username) { 29 | this.username = username; 30 | } 31 | 32 | 33 | public String getPassword() { 34 | return password; 35 | } 36 | 37 | 38 | public void setPassword(String password) { 39 | this.password = password; 40 | } 41 | 42 | 43 | public String getRole() { 44 | return role; 45 | } 46 | 47 | 48 | public void setRole(String role) { 49 | this.role = role; 50 | } 51 | 52 | public Long getIdCliente() { 53 | return idCliente; 54 | } 55 | 56 | 57 | public void setIdCliente(Long idCliente) { 58 | this.idCliente = idCliente; 59 | } 60 | 61 | 62 | public Long getIdEmpleado() { 63 | return idEmpleado; 64 | } 65 | 66 | 67 | public void setIdEmpleado(Long idEmpleado) { 68 | this.idEmpleado = idEmpleado; 69 | } 70 | 71 | 72 | } 73 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/repository/ICategoriaRepository.java: -------------------------------------------------------------------------------- 1 | package com.inventory.repository; 2 | 3 | import java.util.List; 4 | import java.util.Optional; 5 | 6 | import org.springframework.data.jpa.repository.JpaRepository; 7 | import org.springframework.data.jpa.repository.Query; 8 | import org.springframework.data.repository.query.Param; 9 | import org.springframework.stereotype.Repository; 10 | 11 | import com.inventory.entity.Categoria; 12 | 13 | @Repository 14 | public interface ICategoriaRepository extends JpaRepository { 15 | List findByFolderTrue(); // Para obtener solo los nodos padre 16 | 17 | 18 | @Query("SELECT c FROM Categoria c LEFT JOIN FETCH c.productos WHERE c.folder = false") 19 | List obtenerCategoriasConProductos(); 20 | 21 | // consulta por id categoria 22 | /* 23 | @Query("SELECT c FROM Categoria c LEFT JOIN FETCH c.productos WHERE c.folder = false AND c.idCategoria = :idCategoria") 24 | Optional obtenerCategoriaConProductosPorId(@Param("idCategoria") Long idCategoria); 25 | */ 26 | 27 | @Query("SELECT c FROM Categoria c LEFT JOIN FETCH c.productos WHERE c.idCategoria = :idCategoria") 28 | Optional findCategoriaWithProductos(@Param("idCategoria") Long idCategoria); 29 | 30 | //breadcrumb 31 | @Query("SELECT c FROM Categoria c WHERE c.idCategoria = :idCategoria") 32 | Optional findCategoriaById(@Param("idCategoria") Long idCategoria); 33 | 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/entity/UnidadMedida.java: -------------------------------------------------------------------------------- 1 | package com.inventory.entity; 2 | 3 | import jakarta.persistence.Column; 4 | import jakarta.persistence.Entity; 5 | import jakarta.persistence.GeneratedValue; 6 | import jakarta.persistence.GenerationType; 7 | import jakarta.persistence.Id; 8 | import jakarta.persistence.Table; 9 | 10 | @Entity 11 | @Table(name="unidadesMedida") 12 | public class UnidadMedida { 13 | @Id 14 | @GeneratedValue(strategy = GenerationType.IDENTITY) 15 | @Column(name = "id_unidad_medida") 16 | private long idUnidadMedida; 17 | private String unidadMedida; 18 | private String simbolo; 19 | 20 | 21 | public UnidadMedida() { 22 | super(); 23 | } 24 | 25 | public UnidadMedida(long idUnidadMedida, String unidadMedida, String simbolo) { 26 | super(); 27 | this.idUnidadMedida = idUnidadMedida; 28 | this.unidadMedida = unidadMedida; 29 | this.simbolo = simbolo; 30 | } 31 | 32 | 33 | public long getIdUnidadMedida() { 34 | return idUnidadMedida; 35 | } 36 | 37 | public void setIdUnidadMedida(long idUnidadMedida) { 38 | this.idUnidadMedida = idUnidadMedida; 39 | } 40 | 41 | public String getUnidadMedida() { 42 | return unidadMedida; 43 | } 44 | 45 | public void setUnidadMedida(String unidadMedida) { 46 | this.unidadMedida = unidadMedida; 47 | } 48 | 49 | public String getSimbolo() { 50 | return simbolo; 51 | } 52 | 53 | public void setSimbolo(String simbolo) { 54 | this.simbolo = simbolo; 55 | } 56 | 57 | 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/dto/ProductoDto.java: -------------------------------------------------------------------------------- 1 | package com.inventory.dto; 2 | 3 | import java.util.Date; 4 | 5 | import com.inventory.entity.Marca; 6 | import com.inventory.entity.Producto; 7 | import com.inventory.entity.Proveedor; 8 | import com.inventory.entity.Categoria; 9 | import com.inventory.entity.Grupo; 10 | import com.inventory.entity.UnidadMedida; 11 | 12 | /** 13 | * DTO para la transferencia de datos de la entidad {@link Producto}. 14 | */ 15 | public record ProductoDto(long idProducto, String sku, String nombreProducto, String descripcionProducto, double precio, 16 | int cantidad, Date fecha_creacion, Date fecha_actualizacion, int minimo, int maximo, UnidadMedida unidadMedida, 17 | Marca marca, Categoria categoria, Grupo grupo, Proveedor proveedor) { 18 | /** 19 | * Constructor que inicializa un ProductoDto a partir de un objeto Producto. 20 | * 21 | * @param producto entidad Producto para crear el DTO 22 | */ 23 | public ProductoDto(Producto producto) { 24 | this( 25 | producto.getIdProducto(), 26 | producto.getSku(), 27 | producto.getNombreProducto(), 28 | producto.getDescripcionProducto(), 29 | producto.getPrecio(), 30 | producto.getCantidad(), 31 | producto.getFecha_creacion(), 32 | producto.getFecha_actualizacion(), 33 | producto.getMinimo(), 34 | producto.getMaximo(), 35 | producto.getUnidadMedida(), 36 | producto.getMarca(), 37 | producto.getCategoria(), 38 | producto.getGrupo(), 39 | producto.getProveedor()); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /doc/legal/ASSEMBLY_EXCEPTION: -------------------------------------------------------------------------------- 1 | 2 | OPENJDK ASSEMBLY EXCEPTION 3 | 4 | The OpenJDK source code made available by Oracle America, Inc. (Oracle) at 5 | openjdk.org ("OpenJDK Code") is distributed under the terms of the GNU 6 | General Public License version 2 7 | only ("GPL2"), with the following clarification and special exception. 8 | 9 | Linking this OpenJDK Code statically or dynamically with other code 10 | is making a combined work based on this library. Thus, the terms 11 | and conditions of GPL2 cover the whole combination. 12 | 13 | As a special exception, Oracle gives you permission to link this 14 | OpenJDK Code with certain code licensed by Oracle as indicated at 15 | https://openjdk.org/legal/exception-modules-2007-05-08.html 16 | ("Designated Exception Modules") to produce an executable, 17 | regardless of the license terms of the Designated Exception Modules, 18 | and to copy and distribute the resulting executable under GPL2, 19 | provided that the Designated Exception Modules continue to be 20 | governed by the licenses under which they were offered by Oracle. 21 | 22 | As such, it allows licensees and sublicensees of Oracle's GPL2 OpenJDK Code 23 | to build an executable that includes those portions of necessary code that 24 | Oracle could not provide under GPL2 (or that Oracle has provided under GPL2 25 | with the Classpath exception). If you modify or add to the OpenJDK code, 26 | that new GPL2 code may still be combined with Designated Exception Modules 27 | if the new code is made subject to this exception by its copyright holder. 28 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/dto/ProductoSimplificadoDto.java: -------------------------------------------------------------------------------- 1 | package com.inventory.dto; 2 | 3 | import java.util.Date; 4 | 5 | import com.inventory.entity.Marca; 6 | import com.inventory.entity.Producto; 7 | import com.inventory.entity.UnidadMedida; 8 | 9 | public record ProductoSimplificadoDto( 10 | long idProducto, 11 | String sku, 12 | String nombreProducto, 13 | String descripcionProducto, 14 | double precio, 15 | int cantidad, 16 | int minimo, 17 | int maximo, 18 | Date fechaCreacion, 19 | Date fechaActualizacion, 20 | UnidadMedida unidadMedida, 21 | Marca marca, 22 | long idCategoria, // Aquí incluimos solo el ID de la categoría 23 | String nombreCategoria // Incluye también el nombre de la categoría 24 | ) { 25 | public ProductoSimplificadoDto(Producto producto) { 26 | this( 27 | producto.getIdProducto(), 28 | producto.getSku(), 29 | producto.getNombreProducto(), 30 | producto.getDescripcionProducto(), 31 | producto.getPrecio(), 32 | producto.getCantidad(), 33 | producto.getMinimo(), 34 | producto.getMaximo(), 35 | producto.getFecha_creacion(), 36 | producto.getFecha_actualizacion(), 37 | producto.getUnidadMedida(), 38 | producto.getMarca(), 39 | producto.getCategoria() != null ? producto.getCategoria().getIdCategoria() : 0, // Verificamos si existe la categoría 40 | producto.getCategoria() != null ? producto.getCategoria().getNombreCategoria() : null 41 | ); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/entity/ValorAtributo.java: -------------------------------------------------------------------------------- 1 | package com.inventory.entity; 2 | 3 | import jakarta.persistence.Column; 4 | import jakarta.persistence.Entity; 5 | import jakarta.persistence.FetchType; 6 | import jakarta.persistence.GeneratedValue; 7 | import jakarta.persistence.GenerationType; 8 | import jakarta.persistence.Id; 9 | import jakarta.persistence.JoinColumn; 10 | import jakarta.persistence.ManyToOne; 11 | import jakarta.persistence.Table; 12 | 13 | @Entity 14 | @Table(name="valor_atributos") 15 | public class ValorAtributo { 16 | @Id 17 | @GeneratedValue(strategy = GenerationType.IDENTITY) 18 | private Long idValorAtributo; 19 | 20 | @Column(nullable = false) 21 | private String valor; 22 | 23 | @ManyToOne(fetch = FetchType.LAZY) 24 | @JoinColumn(name = "atributo_id") 25 | private Atributo atributo; 26 | 27 | 28 | public ValorAtributo() { 29 | super(); 30 | } 31 | 32 | 33 | public ValorAtributo(Long idValorAtributo, String valor, Atributo atributo) { 34 | super(); 35 | this.idValorAtributo = idValorAtributo; 36 | this.valor = valor; 37 | this.atributo = atributo; 38 | } 39 | 40 | public Long getIdValorAtributo() { 41 | return idValorAtributo; 42 | } 43 | 44 | 45 | public void setIdValorAtributo(Long idValorAtributo) { 46 | this.idValorAtributo = idValorAtributo; 47 | } 48 | 49 | public String getValor() { 50 | return valor; 51 | } 52 | 53 | 54 | public void setValor(String valor) { 55 | this.valor = valor; 56 | } 57 | 58 | 59 | public Atributo getAtributo() { 60 | return atributo; 61 | } 62 | 63 | 64 | public void setAtributo(Atributo atributo) { 65 | this.atributo = atributo; 66 | } 67 | } 68 | 69 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/service/IAlmacenService.java: -------------------------------------------------------------------------------- 1 | package com.inventory.service; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.data.domain.Page; 6 | import org.springframework.data.domain.Pageable; 7 | 8 | import com.inventory.dto.AlmacenDto; 9 | import com.inventory.entity.Almacen; 10 | 11 | /** 12 | * Interfaz de servicio para la entidad {@link Almacen}. 13 | */ 14 | public interface IAlmacenService { 15 | 16 | /** 17 | * Consulta todos los almacenes. 18 | * 19 | * @return lista de almacenes 20 | */ 21 | List findAll(); 22 | 23 | /** 24 | * Consulta todos los almacenes con soporte de paginación. 25 | * 26 | * @param pageable objeto de paginación 27 | * @return página de almacenes 28 | */ 29 | Page findAllPage(Pageable pageable); 30 | 31 | /** 32 | * Busca un almacén por su id. 33 | * 34 | * @param idAlmacen id del almacén a buscar 35 | * @return el almacén si existe 36 | */ 37 | Almacen findById(Long idAlmacen); 38 | 39 | /** 40 | * Crea un nuevo almacén. 41 | * 42 | * @param almacen DTO con datos del almacén a crear 43 | * @return el almacén creado 44 | */ 45 | Almacen createAlmacen(AlmacenDto almacen); 46 | 47 | /** 48 | * Elimina un almacén por su id. 49 | * 50 | * @param idAlmacen id del almacén a eliminar 51 | * @return el almacén eliminado 52 | */ 53 | Almacen deleteAlmacen(Long idAlmacen); 54 | 55 | /** 56 | * Actualiza un almacén existente. 57 | * 58 | * @param idAlmacen id del almacén a actualizar 59 | * @param almacen DTO con los nuevos datos 60 | * @return el almacén actualizado 61 | */ 62 | Almacen updateAlmacen(Long idAlmacen, AlmacenDto almacen); 63 | } 64 | -------------------------------------------------------------------------------- /doc/resource-files/jquery-ui.min.css: -------------------------------------------------------------------------------- 1 | /*! jQuery UI - v1.13.2 - 2023-02-27 2 | * http://jqueryui.com 3 | * Includes: core.css, autocomplete.css, menu.css 4 | * Copyright jQuery Foundation and other contributors; Licensed MIT */ 5 | 6 | .ui-helper-hidden{display:none}.ui-helper-hidden-accessible{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px}.ui-helper-reset{margin:0;padding:0;border:0;outline:0;line-height:1.3;text-decoration:none;font-size:100%;list-style:none}.ui-helper-clearfix:before,.ui-helper-clearfix:after{content:"";display:table;border-collapse:collapse}.ui-helper-clearfix:after{clear:both}.ui-helper-zfix{width:100%;height:100%;top:0;left:0;position:absolute;opacity:0;-ms-filter:"alpha(opacity=0)"}.ui-front{z-index:100}.ui-state-disabled{cursor:default!important;pointer-events:none}.ui-icon{display:inline-block;vertical-align:middle;margin-top:-.25em;position:relative;text-indent:-99999px;overflow:hidden;background-repeat:no-repeat}.ui-widget-icon-block{left:50%;margin-left:-8px;display:block}.ui-widget-overlay{position:fixed;top:0;left:0;width:100%;height:100%}.ui-autocomplete{position:absolute;top:0;left:0;cursor:default}.ui-menu{list-style:none;padding:0;margin:0;display:block;outline:0}.ui-menu .ui-menu{position:absolute}.ui-menu .ui-menu-item{margin:0;cursor:pointer;list-style-image:url("data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7")}.ui-menu .ui-menu-item-wrapper{position:relative;padding:3px 1em 3px .4em}.ui-menu .ui-menu-divider{margin:5px 0;height:0;font-size:0;line-height:0;border-width:1px 0 0 0}.ui-menu .ui-state-focus,.ui-menu .ui-state-active{margin:-1px}.ui-menu-icons{position:relative}.ui-menu-icons .ui-menu-item-wrapper{padding-left:2em}.ui-menu .ui-icon{position:absolute;top:0;bottom:0;left:.2em;margin:auto 0}.ui-menu .ui-menu-icon{left:auto;right:0} -------------------------------------------------------------------------------- /src/main/java/com/inventory/controller/DashboardController.java: -------------------------------------------------------------------------------- 1 | package com.inventory.controller; 2 | 3 | import java.util.HashMap; 4 | import java.util.Map; 5 | 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.http.ResponseEntity; 8 | import org.springframework.web.bind.annotation.CrossOrigin; 9 | import org.springframework.web.bind.annotation.GetMapping; 10 | import org.springframework.web.bind.annotation.RequestMapping; 11 | import org.springframework.web.bind.annotation.RequestMethod; 12 | import org.springframework.web.bind.annotation.RestController; 13 | 14 | import com.inventory.service.ProductoService; 15 | import com.inventory.service.ProveedorService; 16 | import com.inventory.service.UbicacionService; 17 | 18 | @RestController 19 | @CrossOrigin(origins = "http://localhost:4200", methods = { RequestMethod.GET, RequestMethod.POST, RequestMethod.PUT, 20 | RequestMethod.DELETE }) 21 | @RequestMapping("/api/dashboard") 22 | public class DashboardController { 23 | @Autowired 24 | private ProveedorService proveedorService; 25 | 26 | @Autowired 27 | private UbicacionService ubicacionService; 28 | 29 | @Autowired 30 | private ProductoService productoService; 31 | 32 | @GetMapping("/totales") 33 | public ResponseEntity> getTotales() { 34 | long totalProveedores = proveedorService.countProveedores(); 35 | long totalUbicaciones = ubicacionService.countUbicaciones(); 36 | long totalProductos = productoService.countProductos(); 37 | 38 | Map totales = new HashMap<>(); 39 | totales.put("totalProveedores", totalProveedores); 40 | totales.put("totalUbicaciones", totalUbicaciones); 41 | totales.put("totalProductos", totalProductos); 42 | 43 | return ResponseEntity.ok(totales); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /doc/resource-files/copy.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 27 | 28 | 29 | 31 | 33 | 34 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/entity/Grupo.java: -------------------------------------------------------------------------------- 1 | package com.inventory.entity; 2 | 3 | import java.util.List; 4 | 5 | import jakarta.persistence.CascadeType; 6 | import jakarta.persistence.Column; 7 | import jakarta.persistence.Entity; 8 | import jakarta.persistence.FetchType; 9 | import jakarta.persistence.GeneratedValue; 10 | import jakarta.persistence.GenerationType; 11 | import jakarta.persistence.Id; 12 | import jakarta.persistence.OneToMany; 13 | import jakarta.persistence.Table; 14 | 15 | @Entity 16 | @Table(name="grupos") 17 | public class Grupo { 18 | @Id 19 | @GeneratedValue(strategy = GenerationType.IDENTITY) 20 | @Column(name = "id_grupo") 21 | private long idGrupo; 22 | private String nombreGrupo; 23 | private Boolean status; 24 | 25 | @OneToMany(mappedBy = "grupo", fetch = FetchType.LAZY, cascade = CascadeType.ALL) 26 | private List atributos; 27 | 28 | public Grupo() { 29 | super(); 30 | } 31 | 32 | public Grupo(long idGrupo, String nombreGrupo, Boolean status, List atributos) { 33 | super(); 34 | this.idGrupo = idGrupo; 35 | this.nombreGrupo = nombreGrupo; 36 | this.status = status; 37 | this.atributos = atributos; 38 | } 39 | 40 | 41 | 42 | public long getIdGrupo() { 43 | return idGrupo; 44 | } 45 | 46 | public void setIdGrupo(long idGrupo) { 47 | this.idGrupo = idGrupo; 48 | } 49 | 50 | public String getNombreGrupo() { 51 | return nombreGrupo; 52 | } 53 | 54 | public void setNombreGrupo(String nombreGrupo) { 55 | this.nombreGrupo = nombreGrupo; 56 | } 57 | 58 | public Boolean getStatus() { 59 | return status; 60 | } 61 | 62 | public void setStatus(Boolean status) { 63 | this.status = status; 64 | } 65 | 66 | public List getAtributos() { 67 | return atributos; 68 | } 69 | 70 | public void setAtributos(List atributos) { 71 | this.atributos = atributos; 72 | } 73 | 74 | 75 | } 76 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/service/RolService.java: -------------------------------------------------------------------------------- 1 | package com.inventory.service; 2 | 3 | import java.util.List; 4 | import java.util.NoSuchElementException; 5 | 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.data.domain.Page; 8 | import org.springframework.data.domain.Pageable; 9 | import org.springframework.stereotype.Service; 10 | import org.springframework.transaction.annotation.Transactional; 11 | 12 | import com.inventory.dto.RolDto; 13 | import com.inventory.entity.Rol; 14 | import com.inventory.repository.IRolRepository; 15 | 16 | @Service 17 | public class RolService implements IRolService { 18 | 19 | @Autowired 20 | private IRolRepository rolRepository; 21 | 22 | // Consulta todos 23 | @Transactional(readOnly = true) 24 | public List findAll() { 25 | return (List) rolRepository.findAll(); 26 | } 27 | 28 | // consulta todos para paginación 29 | @Transactional(readOnly = true) 30 | public Page findAllPage(Pageable pageable) { 31 | return rolRepository.findAll(pageable); 32 | } 33 | 34 | // consulta por id 35 | @Transactional(readOnly = true) 36 | public Rol findById(Long idRol) { 37 | return rolRepository.findById(idRol).orElse(null); 38 | } 39 | 40 | // Crear 41 | @Transactional 42 | public Rol createRol(RolDto rol) { 43 | Rol rolEntity = new Rol(); 44 | rolEntity.setNombre(rol.nombre()); 45 | return rolRepository.save(rolEntity); 46 | } 47 | 48 | // Eliminar 49 | public Rol deleteRol(Long idRol) { 50 | rolRepository.deleteById(idRol); 51 | return null; 52 | } 53 | 54 | // Modificar 55 | @Transactional 56 | public Rol updateRol(Long idRol, RolDto rol) { 57 | Rol rolEntity = rolRepository.findById(idRol) 58 | .orElseThrow(() -> new NoSuchElementException("Rol no encontrado con el ID: " + idRol)); 59 | rolEntity.setNombre(rol.nombre()); 60 | return rolRepository.save(rolEntity); 61 | } 62 | } -------------------------------------------------------------------------------- /src/main/java/com/inventory/entity/Variante.java: -------------------------------------------------------------------------------- 1 | package com.inventory.entity; 2 | 3 | import jakarta.persistence.Column; 4 | import jakarta.persistence.Entity; 5 | import jakarta.persistence.FetchType; 6 | import jakarta.persistence.GeneratedValue; 7 | import jakarta.persistence.GenerationType; 8 | import jakarta.persistence.Id; 9 | import jakarta.persistence.JoinColumn; 10 | import jakarta.persistence.ManyToOne; 11 | import jakarta.persistence.Table; 12 | 13 | @Entity 14 | @Table(name = "variantes") 15 | public class Variante { 16 | @Id 17 | @GeneratedValue(strategy = GenerationType.IDENTITY) 18 | @Column(name = "id_variante") 19 | private Long idVariante; 20 | 21 | @ManyToOne(fetch = FetchType.LAZY) 22 | @JoinColumn(name = "id_producto", nullable = false) 23 | private Producto producto; 24 | 25 | @ManyToOne(fetch = FetchType.LAZY) 26 | @JoinColumn(name = "id_combinacion_atributos", nullable = false) 27 | private CombinacionAtributos combinacionAtributos; 28 | 29 | public Variante() { 30 | super(); 31 | } 32 | 33 | public Variante(Long idVariante, Producto producto, CombinacionAtributos combinacionAtributos) { 34 | super(); 35 | this.idVariante = idVariante; 36 | this.producto = producto; 37 | this.combinacionAtributos = combinacionAtributos; 38 | } 39 | 40 | public Long getIdVariante() { 41 | return idVariante; 42 | } 43 | 44 | public void setIdVariante(Long idVariante) { 45 | this.idVariante = idVariante; 46 | } 47 | 48 | public Producto getProducto() { 49 | return producto; 50 | } 51 | 52 | public void setProducto(Producto producto) { 53 | this.producto = producto; 54 | } 55 | 56 | public CombinacionAtributos getCombinacionAtributos() { 57 | return combinacionAtributos; 58 | } 59 | 60 | public void setCombinacionAtributos(CombinacionAtributos combinacionAtributos) { 61 | this.combinacionAtributos = combinacionAtributos; 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/security/CustomUsersDetailsService.java: -------------------------------------------------------------------------------- 1 | package com.inventory.security; 2 | 3 | import java.util.Collection; 4 | import java.util.List; 5 | import java.util.stream.Collectors; 6 | 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.security.core.GrantedAuthority; 9 | import org.springframework.security.core.authority.SimpleGrantedAuthority; 10 | import org.springframework.security.core.userdetails.User; 11 | import org.springframework.security.core.userdetails.UserDetails; 12 | import org.springframework.security.core.userdetails.UserDetailsService; 13 | import org.springframework.security.core.userdetails.UsernameNotFoundException; 14 | import org.springframework.stereotype.Service; 15 | 16 | import com.inventory.entity.Rol; 17 | import com.inventory.entity.Usuario; 18 | import com.inventory.repository.IUsuarioRepository; 19 | 20 | 21 | @Service 22 | public class CustomUsersDetailsService implements UserDetailsService{ 23 | 24 | private IUsuarioRepository usuariosRepository; 25 | 26 | @Autowired 27 | public CustomUsersDetailsService(IUsuarioRepository usuariosRepository) { 28 | super(); 29 | this.usuariosRepository = usuariosRepository; 30 | } 31 | 32 | // Método para traernos una lista de autoridades por medio de una lista de roles 33 | public CollectionmapToAuthorities(Listroles){ 34 | return roles.stream().map(role -> new SimpleGrantedAuthority(role.getNombre())).collect(Collectors.toList()); 35 | } 36 | 37 | // Método para traernos un usuario con todos sus datos por medio de su username 38 | @Override 39 | public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { 40 | Usuario usuarios = usuariosRepository.findByUsername(username).orElseThrow(()-> new UsernameNotFoundException("Usuario no encontrado")); 41 | return new User(usuarios.getUsername(), usuarios.getPassword(), mapToAuthorities(usuarios.getRol())); 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/service/IAtributoService.java: -------------------------------------------------------------------------------- 1 | package com.inventory.service; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.data.domain.Page; 6 | import org.springframework.data.domain.Pageable; 7 | 8 | import com.inventory.dto.AtributoDto; 9 | import com.inventory.entity.Atributo; 10 | 11 | /** 12 | * Interfaz de servicio para la entidad {@link Atributo}. 13 | */ 14 | public interface IAtributoService { 15 | /** 16 | * Consulta todos los atributos. 17 | * 18 | * @return lista de atributos 19 | */ 20 | List findAll(); 21 | 22 | /** 23 | * Consulta todos los atributos con soporte de paginación. 24 | * 25 | * @param pageable objeto de paginación 26 | * @return página de atributos 27 | */ 28 | Page findAllPage(Pageable pageable); 29 | 30 | /** 31 | * Busca un atributo por su id. 32 | * 33 | * @param idAtributo id del atributo a buscar 34 | * @return el atributo si existe 35 | */ 36 | Atributo findById(Long idAtributo); 37 | 38 | /** 39 | * Crea un nuevo atributo. 40 | * 41 | * @param atributo DTO con datos del atributo a crear 42 | * @return el atributo creado 43 | */ 44 | //Atributo createAtributo(AtributoDto atributo); 45 | Atributo createAtributo(Long grupoId, Atributo atributo); 46 | 47 | 48 | 49 | List getAtributosByGrupo(Long grupoId); 50 | 51 | /** 52 | * Elimina un atributo por su id. 53 | * 54 | * @param idAtributo id del atributo a eliminar 55 | * @return el atributo eliminado 56 | */ 57 | Atributo deleteAtributo(Long idAtributo); 58 | 59 | /** 60 | * Actualiza un atributo existente. 61 | * 62 | * @param idAtributo id del atributo a actualizar 63 | * @param Atributo DTO con los nuevos datos 64 | * @return el atributo actualizado 65 | */ 66 | Atributo updateAtributo(Long idAtributo, AtributoDto atributo); 67 | } 68 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/entity/Inventario.java: -------------------------------------------------------------------------------- 1 | package com.inventory.entity; 2 | 3 | import jakarta.persistence.Column; 4 | import jakarta.persistence.Entity; 5 | import jakarta.persistence.FetchType; 6 | import jakarta.persistence.GeneratedValue; 7 | import jakarta.persistence.GenerationType; 8 | import jakarta.persistence.Id; 9 | import jakarta.persistence.JoinColumn; 10 | import jakarta.persistence.ManyToOne; 11 | import jakarta.persistence.Table; 12 | 13 | @Entity 14 | @Table(name="inventario") 15 | public class Inventario { 16 | @Id 17 | @GeneratedValue(strategy = GenerationType.IDENTITY) 18 | @Column(name = "id_inventario") 19 | private Long idInventario; 20 | 21 | @ManyToOne(fetch = FetchType.LAZY) 22 | @JoinColumn(name = "id_variante", nullable = false) 23 | private Variante variante; 24 | 25 | private int cantidad; 26 | 27 | @ManyToOne 28 | @JoinColumn(name="almacen_id") 29 | private Almacen almacen; 30 | 31 | public Inventario() { 32 | super(); 33 | } 34 | 35 | 36 | 37 | public Inventario(Long idInventario, Variante variante, int cantidad, Almacen almacen) { 38 | super(); 39 | this.idInventario = idInventario; 40 | this.variante = variante; 41 | this.cantidad = cantidad; 42 | this.almacen = almacen; 43 | } 44 | 45 | 46 | 47 | public Long getIdInventario() { 48 | return idInventario; 49 | } 50 | 51 | public void setIdInventario(Long idInventario) { 52 | this.idInventario = idInventario; 53 | } 54 | 55 | public Variante getVariante() { 56 | return variante; 57 | } 58 | 59 | public void setVariante(Variante variante) { 60 | this.variante = variante; 61 | } 62 | 63 | public int getCantidad() { 64 | return cantidad; 65 | } 66 | 67 | public void setCantidad(int cantidad) { 68 | this.cantidad = cantidad; 69 | } 70 | 71 | 72 | 73 | public Almacen getAlmacen() { 74 | return almacen; 75 | } 76 | 77 | 78 | 79 | public void setAlmacen(Almacen almacen) { 80 | this.almacen = almacen; 81 | } 82 | 83 | 84 | } -------------------------------------------------------------------------------- /src/main/java/com/inventory/service/IMarcaService.java: -------------------------------------------------------------------------------- 1 | package com.inventory.service; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.data.domain.Page; 6 | import org.springframework.data.domain.Pageable; 7 | 8 | import com.inventory.dto.MarcaDto; 9 | import com.inventory.entity.Marca; 10 | 11 | /** 12 | * Interface de servicio que define las operaciones para la entidad {@link Marca}. 13 | * Métodos incluidos: 14 | * - Búsqueda de todas las marcas. 15 | * - Paginación. 16 | * - Creación, eliminación y actualización de marcas. 17 | */ 18 | public interface IMarcaService { 19 | 20 | /** 21 | * Consulta todas las marcas. 22 | * 23 | * @return una lista con todas las marcas. 24 | */ 25 | List findAll(); 26 | 27 | /** 28 | * Consulta todas las marcas con paginación. 29 | * 30 | * @param pageable objeto de paginación que contiene página, tamaño, etc. 31 | * @return una página con marcas. 32 | */ 33 | Page findAllPage(Pageable pageable); 34 | 35 | /** 36 | * Busca una marca por su ID. 37 | * 38 | * @param idMarca ID de la marca a buscar. 39 | * @return la marca encontrada o null si no existe. 40 | */ 41 | Marca findById(Long idMarca); 42 | 43 | /** 44 | * Crea una nueva marca. 45 | * 46 | * @param marca DTO de la marca a crear. 47 | * @return la marca creada. 48 | */ 49 | Marca createMarca(MarcaDto marca); 50 | 51 | /** 52 | * Elimina una marca por su ID. 53 | * 54 | * @param idMarca ID de la marca a eliminar. 55 | * @return la marca eliminada o null si no existe. 56 | */ 57 | Marca deleteMarca(Long idMarca); 58 | 59 | /** 60 | * Actualiza una marca existente. 61 | * 62 | * @param idMarca ID de la marca a actualizar. 63 | * @param marca DTO de la marca con la información actualizada. 64 | * @return la marca actualizada. 65 | */ 66 | Marca updateMarca(Long idMarca, MarcaDto marca); 67 | } 68 | -------------------------------------------------------------------------------- /doc/legal/jqueryUI.md: -------------------------------------------------------------------------------- 1 | ## jQuery UI v1.13.2 2 | 3 | ### jQuery UI License 4 | ``` 5 | Copyright jQuery Foundation and other contributors, https://jquery.org/ 6 | 7 | This software consists of voluntary contributions made by many 8 | individuals. For exact contribution history, see the revision history 9 | available at https://github.com/jquery/jquery-ui 10 | 11 | The following license applies to all parts of this software except as 12 | documented below: 13 | 14 | ==== 15 | 16 | Permission is hereby granted, free of charge, to any person obtaining 17 | a copy of this software and associated documentation files (the 18 | "Software"), to deal in the Software without restriction, including 19 | without limitation the rights to use, copy, modify, merge, publish, 20 | distribute, sublicense, and/or sell copies of the Software, and to 21 | permit persons to whom the Software is furnished to do so, subject to 22 | the following conditions: 23 | 24 | The above copyright notice and this permission notice shall be 25 | included in all copies or substantial portions of the Software. 26 | 27 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 28 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 29 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 30 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 31 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 32 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 33 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 34 | 35 | ==== 36 | 37 | Copyright and related rights for sample code are waived via CC0. Sample 38 | code is defined as all source code contained within the demos directory. 39 | 40 | CC0: http://creativecommons.org/publicdomain/zero/1.0/ 41 | 42 | ==== 43 | 44 | All files located in the node_modules and external directories are 45 | externally maintained libraries used by this software which have their 46 | own licenses; we recommend you read them, as their terms may differ from 47 | the terms above. 48 | 49 | ``` 50 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/entity/Ubicacion.java: -------------------------------------------------------------------------------- 1 | package com.inventory.entity; 2 | 3 | import jakarta.persistence.Column; 4 | import jakarta.persistence.Entity; 5 | import jakarta.persistence.GeneratedValue; 6 | import jakarta.persistence.GenerationType; 7 | import jakarta.persistence.Id; 8 | import jakarta.persistence.Table; 9 | 10 | @Entity 11 | @Table(name="ubicaciones") 12 | public class Ubicacion { 13 | @Id 14 | @GeneratedValue(strategy = GenerationType.IDENTITY) 15 | @Column(name = "id_ubicacion") 16 | private long idUbicacion; 17 | private String nombreUbicacion; 18 | private String direccionUbicacion; 19 | private String telefono; 20 | private String responsable; 21 | 22 | 23 | public Ubicacion() { 24 | super(); 25 | } 26 | 27 | public Ubicacion(long idUbicacion, String nombreUbicacion, String direccionUbicacion, String telefono, 28 | String responsable) { 29 | super(); 30 | this.idUbicacion = idUbicacion; 31 | this.nombreUbicacion = nombreUbicacion; 32 | this.direccionUbicacion = direccionUbicacion; 33 | this.telefono = telefono; 34 | this.responsable = responsable; 35 | } 36 | 37 | public long getIdUbicacion() { 38 | return idUbicacion; 39 | } 40 | 41 | public void setIdUbicacion(long idUbicacion) { 42 | this.idUbicacion = idUbicacion; 43 | } 44 | 45 | public String getNombreUbicacion() { 46 | return nombreUbicacion; 47 | } 48 | 49 | public void setNombreUbicacion(String nombreUbicacion) { 50 | this.nombreUbicacion = nombreUbicacion; 51 | } 52 | 53 | public String getDireccionUbicacion() { 54 | return direccionUbicacion; 55 | } 56 | 57 | public void setDireccionUbicacion(String direccionUbicacion) { 58 | this.direccionUbicacion = direccionUbicacion; 59 | } 60 | 61 | public String getTelefono() { 62 | return telefono; 63 | } 64 | 65 | public void setTelefono(String telefono) { 66 | this.telefono = telefono; 67 | } 68 | 69 | public String getResponsable() { 70 | return responsable; 71 | } 72 | 73 | public void setResponsable(String responsable) { 74 | this.responsable = responsable; 75 | } 76 | 77 | } 78 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/entity/Atributo.java: -------------------------------------------------------------------------------- 1 | package com.inventory.entity; 2 | 3 | import java.util.List; 4 | 5 | import jakarta.persistence.CascadeType; 6 | import jakarta.persistence.Column; 7 | import jakarta.persistence.Entity; 8 | import jakarta.persistence.FetchType; 9 | import jakarta.persistence.GeneratedValue; 10 | import jakarta.persistence.GenerationType; 11 | import jakarta.persistence.Id; 12 | import jakarta.persistence.JoinColumn; 13 | import jakarta.persistence.ManyToOne; 14 | import jakarta.persistence.OneToMany; 15 | import jakarta.persistence.Table; 16 | 17 | @Entity 18 | @Table(name="atributos") 19 | public class Atributo { 20 | @Id 21 | @GeneratedValue(strategy = GenerationType.IDENTITY) 22 | private Long idAtributo; 23 | 24 | @Column(nullable = false) 25 | private String atributo; 26 | 27 | @ManyToOne(fetch = FetchType.LAZY) 28 | @JoinColumn(name = "grupo_id") 29 | private Grupo grupo; 30 | 31 | @OneToMany(mappedBy = "atributo", fetch = FetchType.LAZY, cascade = CascadeType.ALL) 32 | private List valores; 33 | 34 | public Atributo() { 35 | super(); 36 | } 37 | 38 | public Atributo(Long idAtributo, String atributo, Grupo grupo, List valores) { 39 | super(); 40 | this.idAtributo = idAtributo; 41 | this.atributo = atributo; 42 | this.grupo = grupo; 43 | this.valores = valores; 44 | } 45 | 46 | 47 | 48 | public Long getIdAtributo() { 49 | return idAtributo; 50 | } 51 | 52 | public void setIdAtributo(Long idAtributo) { 53 | this.idAtributo = idAtributo; 54 | } 55 | 56 | public String getAtributo() { 57 | return atributo; 58 | } 59 | 60 | public void setAtributo(String atributo) { 61 | this.atributo = atributo; 62 | } 63 | 64 | public Grupo getGrupo() { 65 | return grupo; 66 | } 67 | 68 | public void setGrupo(Grupo grupo) { 69 | this.grupo = grupo; 70 | } 71 | 72 | public List getValores() { 73 | return valores; 74 | } 75 | 76 | public void setValores(List valores) { 77 | this.valores = valores; 78 | } 79 | 80 | } 81 | 82 | -------------------------------------------------------------------------------- /doc/resource-files/link.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/entity/Usuario.java: -------------------------------------------------------------------------------- 1 | package com.inventory.entity; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import jakarta.persistence.CascadeType; 7 | import jakarta.persistence.Column; 8 | import jakarta.persistence.Entity; 9 | import jakarta.persistence.FetchType; 10 | import jakarta.persistence.GeneratedValue; 11 | import jakarta.persistence.GenerationType; 12 | import jakarta.persistence.Id; 13 | import jakarta.persistence.JoinColumn; 14 | import jakarta.persistence.JoinTable; 15 | import jakarta.persistence.ManyToMany; 16 | import jakarta.persistence.Table; 17 | 18 | @Entity 19 | @Table(name = "usuarios") 20 | public class Usuario { 21 | @Id 22 | @GeneratedValue(strategy = GenerationType.IDENTITY) 23 | @Column(name = "id_usuario") 24 | private long idUsuario; 25 | private String username; 26 | private String password; 27 | @ManyToMany(fetch = FetchType.EAGER, cascade = CascadeType.MERGE) 28 | @JoinTable(name = "usuarios_roles", joinColumns = @JoinColumn(name = "usuario_id", referencedColumnName = "id_usuario") 29 | , inverseJoinColumns = @JoinColumn(name = "rol_id", referencedColumnName = "id_rol")) 30 | private List rol = new ArrayList<>(); 31 | 32 | 33 | public Usuario() { 34 | super(); 35 | } 36 | 37 | public Usuario(long idUsuario, String username, String password, List rol) { 38 | super(); 39 | this.idUsuario = idUsuario; 40 | this.username = username; 41 | this.password = password; 42 | this.rol = rol; 43 | } 44 | 45 | public long getIdUsuario() { 46 | return idUsuario; 47 | } 48 | 49 | public void setIdUsuario(long idUsuario) { 50 | this.idUsuario = idUsuario; 51 | } 52 | 53 | public String getUsername() { 54 | return username; 55 | } 56 | 57 | public void setUsername(String username) { 58 | this.username = username; 59 | } 60 | 61 | public String getPassword() { 62 | return password; 63 | } 64 | 65 | public void setPassword(String password) { 66 | this.password = password; 67 | } 68 | 69 | public List getRol() { 70 | return rol; 71 | } 72 | 73 | public void setRol(List rol) { 74 | this.rol = rol; 75 | } 76 | 77 | } 78 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/entity/DetalleOrdenCompra.java: -------------------------------------------------------------------------------- 1 | package com.inventory.entity; 2 | 3 | import jakarta.persistence.FetchType; 4 | import jakarta.persistence.JoinColumn; 5 | import jakarta.persistence.ManyToOne; 6 | /** 7 | * @author RBaume 8 | * Representa el Detalle de una Orden de Compra en el sistema de inventario. 9 | * Esta entidad contiene la información principal del Detalle de la Orden de Compra. 10 | */ 11 | public class DetalleOrdenCompra { 12 | private long idDetalleOrdenCompra; 13 | private int cantidad; 14 | private double precioUnitario; 15 | @ManyToOne(fetch = FetchType.EAGER) 16 | @JoinColumn(name = "ordenCompraId") 17 | private OrdenCompra ordenCompra; 18 | @ManyToOne(fetch = FetchType.EAGER) 19 | @JoinColumn(name = "productoId") 20 | private Producto producto; 21 | 22 | public DetalleOrdenCompra() { 23 | super(); 24 | } 25 | 26 | public DetalleOrdenCompra(long idDetalleOrdenCompra, int cantidad, double precioUnitario, OrdenCompra ordenCompra, 27 | Producto producto) { 28 | super(); 29 | this.idDetalleOrdenCompra = idDetalleOrdenCompra; 30 | this.cantidad = cantidad; 31 | this.precioUnitario = precioUnitario; 32 | this.ordenCompra = ordenCompra; 33 | this.producto = producto; 34 | } 35 | 36 | public long getIdDetalleOrdenCompra() { 37 | return idDetalleOrdenCompra; 38 | } 39 | 40 | public void setIdDetalleOrdenCompra(long idDetalleOrdenCompra) { 41 | this.idDetalleOrdenCompra = idDetalleOrdenCompra; 42 | } 43 | 44 | public int getCantidad() { 45 | return cantidad; 46 | } 47 | 48 | public void setCantidad(int cantidad) { 49 | this.cantidad = cantidad; 50 | } 51 | 52 | public double getPrecioUnitario() { 53 | return precioUnitario; 54 | } 55 | 56 | public void setPrecioUnitario(double precioUnitario) { 57 | this.precioUnitario = precioUnitario; 58 | } 59 | 60 | public OrdenCompra getOrdenCompra() { 61 | return ordenCompra; 62 | } 63 | 64 | public void setOrdenCompra(OrdenCompra ordenCompra) { 65 | this.ordenCompra = ordenCompra; 66 | } 67 | 68 | public Producto getProducto() { 69 | return producto; 70 | } 71 | 72 | public void setProducto(Producto producto) { 73 | this.producto = producto; 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/entity/CombinacionAtributos.java: -------------------------------------------------------------------------------- 1 | package com.inventory.entity; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import jakarta.persistence.CascadeType; 7 | import jakarta.persistence.Column; 8 | import jakarta.persistence.Entity; 9 | import jakarta.persistence.FetchType; 10 | import jakarta.persistence.GeneratedValue; 11 | import jakarta.persistence.GenerationType; 12 | import jakarta.persistence.Id; 13 | import jakarta.persistence.JoinColumn; 14 | import jakarta.persistence.ManyToOne; 15 | import jakarta.persistence.OneToMany; 16 | import jakarta.persistence.Table; 17 | 18 | @Entity 19 | @Table(name = "combinaciones_atributos") 20 | public class CombinacionAtributos { 21 | @Id 22 | @GeneratedValue(strategy = GenerationType.IDENTITY) 23 | @Column(name = "id_combinacion_atributos") 24 | private Long idCombinacionAtributos; 25 | 26 | @ManyToOne(fetch = FetchType.LAZY) 27 | @JoinColumn(name = "grupo_id", nullable = false) 28 | private Grupo grupo; 29 | 30 | @OneToMany(mappedBy = "combinacionAtributos", cascade = CascadeType.ALL, fetch = FetchType.EAGER) 31 | private List valoresAtributos = new ArrayList<>(); 32 | 33 | public CombinacionAtributos() { 34 | super(); 35 | } 36 | 37 | public CombinacionAtributos(Long idCombinacionAtributos, Grupo grupo, 38 | List valoresAtributos) { 39 | super(); 40 | this.idCombinacionAtributos = idCombinacionAtributos; 41 | this.grupo = grupo; 42 | this.valoresAtributos = valoresAtributos; 43 | } 44 | 45 | public Long getIdCombinacionAtributos() { 46 | return idCombinacionAtributos; 47 | } 48 | 49 | public void setIdCombinacionAtributos(Long idCombinacionAtributos) { 50 | this.idCombinacionAtributos = idCombinacionAtributos; 51 | } 52 | 53 | public Grupo getGrupo() { 54 | return grupo; 55 | } 56 | 57 | public void setGrupo(Grupo grupo) { 58 | this.grupo = grupo; 59 | } 60 | 61 | public List getValoresAtributos() { 62 | return valoresAtributos; 63 | } 64 | 65 | public void setValoresAtributos(List valoresAtributos) { 66 | this.valoresAtributos = valoresAtributos; 67 | } 68 | 69 | 70 | } 71 | -------------------------------------------------------------------------------- /doc/legal/ADDITIONAL_LICENSE_INFO: -------------------------------------------------------------------------------- 1 | ADDITIONAL INFORMATION ABOUT LICENSING 2 | 3 | Certain files distributed by Oracle America, Inc. and/or its affiliates are 4 | subject to the following clarification and special exception to the GPLv2, 5 | based on the GNU Project exception for its Classpath libraries, known as the 6 | GNU Classpath Exception. 7 | 8 | Note that Oracle includes multiple, independent programs in this software 9 | package. Some of those programs are provided under licenses deemed 10 | incompatible with the GPLv2 by the Free Software Foundation and others. 11 | For example, the package includes programs licensed under the Apache 12 | License, Version 2.0 and may include FreeType. Such programs are licensed 13 | to you under their original licenses. 14 | 15 | Oracle facilitates your further distribution of this package by adding the 16 | Classpath Exception to the necessary parts of its GPLv2 code, which permits 17 | you to use that code in combination with other independent modules not 18 | licensed under the GPLv2. However, note that this would not permit you to 19 | commingle code under an incompatible license with Oracle's GPLv2 licensed 20 | code by, for example, cutting and pasting such code into a file also 21 | containing Oracle's GPLv2 licensed code and then distributing the result. 22 | 23 | Additionally, if you were to remove the Classpath Exception from any of the 24 | files to which it applies and distribute the result, you would likely be 25 | required to license some or all of the other code in that distribution under 26 | the GPLv2 as well, and since the GPLv2 is incompatible with the license terms 27 | of some items included in the distribution by Oracle, removing the Classpath 28 | Exception could therefore effectively compromise your ability to further 29 | distribute the package. 30 | 31 | Failing to distribute notices associated with some files may also create 32 | unexpected legal consequences. 33 | 34 | Proceed with caution and we recommend that you obtain the advice of a lawyer 35 | skilled in open source matters before removing the Classpath Exception or 36 | making modifications to this package which may subsequently be redistributed 37 | and/or involve the use of third party software. 38 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/entity/CombinacionValorAtributo.java: -------------------------------------------------------------------------------- 1 | package com.inventory.entity; 2 | 3 | import jakarta.persistence.Column; 4 | import jakarta.persistence.Entity; 5 | import jakarta.persistence.FetchType; 6 | import jakarta.persistence.GeneratedValue; 7 | import jakarta.persistence.GenerationType; 8 | import jakarta.persistence.Id; 9 | import jakarta.persistence.JoinColumn; 10 | import jakarta.persistence.ManyToOne; 11 | import jakarta.persistence.Table; 12 | 13 | @Entity 14 | @Table(name = "combinacion_valor_atributos") 15 | public class CombinacionValorAtributo { 16 | @Id 17 | @GeneratedValue(strategy = GenerationType.IDENTITY) 18 | @Column(name = "id_combinacion_valor_atributo") 19 | private Long idCombinacionValorAtributo; 20 | 21 | @ManyToOne(fetch = FetchType.LAZY) 22 | @JoinColumn(name = "id_combinacion_atributos", nullable = false) 23 | private CombinacionAtributos combinacionAtributos; 24 | 25 | @ManyToOne(fetch = FetchType.EAGER) 26 | @JoinColumn(name = "valor_atributo_id", nullable = false) 27 | private ValorAtributo valorAtributo; 28 | 29 | public CombinacionValorAtributo() { 30 | super(); 31 | } 32 | 33 | public CombinacionValorAtributo(Long idCombinacionValorAtributo, CombinacionAtributos combinacionAtributos, 34 | ValorAtributo valorAtributo) { 35 | super(); 36 | this.idCombinacionValorAtributo = idCombinacionValorAtributo; 37 | this.combinacionAtributos = combinacionAtributos; 38 | this.valorAtributo = valorAtributo; 39 | } 40 | 41 | public Long getIdCombinacionValorAtributo() { 42 | return idCombinacionValorAtributo; 43 | } 44 | 45 | public void setIdCombinacionValorAtributo(Long idCombinacionValorAtributo) { 46 | this.idCombinacionValorAtributo = idCombinacionValorAtributo; 47 | } 48 | 49 | public CombinacionAtributos getCombinacionAtributos() { 50 | return combinacionAtributos; 51 | } 52 | 53 | public void setCombinacionAtributos(CombinacionAtributos combinacionAtributos) { 54 | this.combinacionAtributos = combinacionAtributos; 55 | } 56 | 57 | public ValorAtributo getValorAtributo() { 58 | return valorAtributo; 59 | } 60 | 61 | public void setValorAtributo(ValorAtributo valorAtributo) { 62 | this.valorAtributo = valorAtributo; 63 | } 64 | 65 | } 66 | 67 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/service/IValorAtributoService.java: -------------------------------------------------------------------------------- 1 | package com.inventory.service; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.data.domain.Page; 6 | import org.springframework.data.domain.Pageable; 7 | 8 | import com.inventory.dto.AtributoDto; 9 | import com.inventory.dto.ValorAtributoDto; 10 | import com.inventory.entity.Atributo; 11 | import com.inventory.entity.ValorAtributo; 12 | 13 | /** 14 | * Interfaz de servicio para la entidad {@link ValorAtributo}. 15 | */ 16 | public interface IValorAtributoService { 17 | 18 | /** 19 | * Consulta todos los valores atributos. 20 | * 21 | * @return lista de valores atributos 22 | */ 23 | List findAll(); 24 | 25 | /** 26 | * Consulta todos los valores atributos con soporte de paginación. 27 | * 28 | * @param pageable objeto de paginación 29 | * @return página de valores atributos 30 | */ 31 | Page findAllPage(Pageable pageable); 32 | 33 | /** 34 | * Busca un valore atributo por su id. 35 | * 36 | * @param idValorAtributo id del valor atributo a buscar 37 | * @return el valorAtributo si existe 38 | */ 39 | ValorAtributo findById(Long idValorAtributo); 40 | 41 | /** 42 | * Crea un nuevo valorAtributo. 43 | * 44 | * @param valorAtributo DTO con datos del valorAtributo a crear 45 | * @return el valorAtributo creado 46 | */ 47 | //Atributo createAtributo(AtributoDto atributo); 48 | ValorAtributo createValorAtributo(Long atributoId, ValorAtributo valorAtributo); 49 | 50 | 51 | 52 | List getValoresAtributosByAtributo(Long atributoId); 53 | 54 | /** 55 | * Elimina un valorAtributo por su id. 56 | * 57 | * @param idValorAtributo id del valorAtributo a eliminar 58 | * @return el valorAtributo eliminado 59 | */ 60 | ValorAtributo deleteValorAtributo(Long idValorAtributo); 61 | 62 | /** 63 | * Actualiza un valor atributo existente. 64 | * 65 | * @param idValorAtributo id del valorAtributo a actualizar 66 | * @param valorAtributo DTO con los nuevos datos 67 | * @return el valorAtributo actualizado 68 | */ 69 | ValorAtributo updateValorAtributo(Long idValorAtributo, ValorAtributoDto valorAtributo); 70 | } 71 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/controller/CombinacionAtributosController.java: -------------------------------------------------------------------------------- 1 | package com.inventory.controller; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.http.HttpStatus; 7 | import org.springframework.http.ResponseEntity; 8 | import org.springframework.web.bind.annotation.CrossOrigin; 9 | import org.springframework.web.bind.annotation.PostMapping; 10 | import org.springframework.web.bind.annotation.RequestBody; 11 | import org.springframework.web.bind.annotation.RequestMapping; 12 | import org.springframework.web.bind.annotation.RequestMethod; 13 | import org.springframework.web.bind.annotation.RequestParam; 14 | import org.springframework.web.bind.annotation.RestController; 15 | 16 | import com.inventory.entity.CombinacionAtributos; 17 | import com.inventory.service.ICombinacionAtributosService; 18 | 19 | @RestController 20 | @CrossOrigin(origins = "http://localhost:4200", methods = { RequestMethod.GET, RequestMethod.POST, RequestMethod.PUT, 21 | RequestMethod.DELETE }) 22 | @RequestMapping("/api") 23 | public class CombinacionAtributosController { 24 | @Autowired 25 | private ICombinacionAtributosService combinacionAtributosService; 26 | 27 | /** 28 | * Endpoint para crear una nueva combinación de atributos asociada a un grupo. 29 | * 30 | * @param grupoId ID del grupo al que se asociará la combinación de atributos 31 | * @param valorAtributoIds Lista de IDs de los valores de atributos que se incluirán en la combinación 32 | * @return La combinación de atributos creada o un mensaje de error si el grupo no existe 33 | */ 34 | @PostMapping("/combinacionesAtributos") 35 | public ResponseEntity createCombinacion( 36 | @RequestParam Long grupoId, 37 | @RequestBody List valorAtributoIds) { 38 | 39 | // Llamar al servicio para crear la combinación de atributos 40 | CombinacionAtributos combinacion = combinacionAtributosService.createCombinacion(grupoId, valorAtributoIds); 41 | 42 | if (combinacion == null) { 43 | return ResponseEntity.status(HttpStatus.NOT_FOUND).body("Grupo no encontrado con el ID proporcionado."); 44 | } 45 | 46 | return ResponseEntity.status(HttpStatus.CREATED).body(combinacion); 47 | } 48 | } -------------------------------------------------------------------------------- /src/main/java/com/inventory/entity/InventarioProductoAtributos.java: -------------------------------------------------------------------------------- 1 | package com.inventory.entity; 2 | 3 | import jakarta.persistence.Column; 4 | import jakarta.persistence.Entity; 5 | import jakarta.persistence.GeneratedValue; 6 | import jakarta.persistence.GenerationType; 7 | import jakarta.persistence.Id; 8 | import jakarta.persistence.JoinColumn; 9 | import jakarta.persistence.ManyToOne; 10 | import jakarta.persistence.Table; 11 | 12 | @Entity 13 | @Table(name="inventarios") 14 | public class InventarioProductoAtributos { 15 | @Id 16 | @GeneratedValue(strategy = GenerationType.IDENTITY) 17 | private Long idInventario; 18 | 19 | @ManyToOne 20 | @JoinColumn(name = "producto_id") 21 | private Producto producto; 22 | 23 | @ManyToOne 24 | @JoinColumn(name = "valor_atributo_id") 25 | private ValorAtributo valorAtributo; 26 | 27 | @Column(nullable = false) 28 | private int cantidad; 29 | 30 | @ManyToOne 31 | @JoinColumn(name="almacen_id") 32 | private Almacen almacen; 33 | 34 | public InventarioProductoAtributos() { 35 | super(); 36 | } 37 | 38 | public InventarioProductoAtributos(Long idInventario, Producto producto, ValorAtributo valorAtributo, int cantidad, 39 | Almacen almacen) { 40 | super(); 41 | this.idInventario = idInventario; 42 | this.producto = producto; 43 | this.valorAtributo = valorAtributo; 44 | this.cantidad = cantidad; 45 | this.almacen = almacen; 46 | } 47 | 48 | public Long getIdInventario() { 49 | return idInventario; 50 | } 51 | 52 | public void setIdInventario(Long idInventario) { 53 | this.idInventario = idInventario; 54 | } 55 | 56 | public Producto getProducto() { 57 | return producto; 58 | } 59 | 60 | public void setProducto(Producto producto) { 61 | this.producto = producto; 62 | } 63 | 64 | public ValorAtributo getValorAtributo() { 65 | return valorAtributo; 66 | } 67 | 68 | public void setValorAtributo(ValorAtributo valorAtributo) { 69 | this.valorAtributo = valorAtributo; 70 | } 71 | 72 | public int getCantidad() { 73 | return cantidad; 74 | } 75 | 76 | public void setCantidad(int cantidad) { 77 | this.cantidad = cantidad; 78 | } 79 | 80 | public Almacen getAlmacen() { 81 | return almacen; 82 | } 83 | 84 | public void setAlmacen(Almacen almacen) { 85 | this.almacen = almacen; 86 | } 87 | 88 | } 89 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/DataInitializer.java: -------------------------------------------------------------------------------- 1 | package com.inventory; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.boot.ApplicationRunner; 7 | import org.springframework.context.annotation.Bean; 8 | import org.springframework.context.annotation.Configuration; 9 | import org.springframework.security.crypto.password.PasswordEncoder; 10 | 11 | import com.inventory.entity.Rol; 12 | import com.inventory.entity.Usuario; 13 | import com.inventory.repository.IRolRepository; 14 | import com.inventory.repository.IUsuarioRepository; 15 | 16 | import jakarta.transaction.Transactional; 17 | 18 | @Configuration 19 | public class DataInitializer { 20 | 21 | @Autowired 22 | private IUsuarioRepository usuarioRepository; 23 | 24 | @Autowired 25 | private IRolRepository rolRepository; 26 | 27 | @Autowired 28 | private PasswordEncoder passwordEncoder; 29 | 30 | @Bean 31 | public ApplicationRunner initData() { 32 | return args -> initializeRolesAndUsers(); 33 | } 34 | 35 | @Transactional 36 | public void initializeRolesAndUsers() { 37 | // Verifica y crea roles solo si faltan 38 | Rol adminRole = rolRepository.findByNombre("ADMIN") 39 | .orElseGet(() -> rolRepository.save(new Rol(null, "ADMIN"))); 40 | Rol userRole = rolRepository.findByNombre("USER") 41 | .orElseGet(() -> rolRepository.save(new Rol(null, "USER"))); 42 | 43 | // Verifica y crea el usuario administrador solo si falta 44 | if (usuarioRepository.findByUsername("admin@server.com").isEmpty()) { 45 | Usuario adminUser = new Usuario(); 46 | adminUser.setUsername("admin@server.com"); 47 | adminUser.setPassword(passwordEncoder.encode("1234")); 48 | adminUser.setRol(List.of(adminRole)); 49 | usuarioRepository.save(adminUser); 50 | } 51 | 52 | // Verifica y crea el usuario regular solo si falta 53 | if (usuarioRepository.findByUsername("user@server.com").isEmpty()) { 54 | Usuario normalUser = new Usuario(); 55 | normalUser.setUsername("user@server.com"); 56 | normalUser.setPassword(passwordEncoder.encode("1234")); 57 | normalUser.setRol(List.of(userRole)); 58 | usuarioRepository.save(normalUser); 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/service/UnidadMedidaService.java: -------------------------------------------------------------------------------- 1 | package com.inventory.service; 2 | 3 | import java.util.List; 4 | import java.util.NoSuchElementException; 5 | 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.data.domain.Page; 8 | import org.springframework.data.domain.Pageable; 9 | import org.springframework.data.domain.Sort; 10 | import org.springframework.stereotype.Service; 11 | import org.springframework.transaction.annotation.Transactional; 12 | 13 | import com.inventory.dto.UnidadMedidaDto; 14 | import com.inventory.entity.UnidadMedida; 15 | import com.inventory.repository.IUnidadMedidaRepository; 16 | 17 | @Service 18 | public class UnidadMedidaService implements IUnidadMedidaService { 19 | 20 | @Autowired 21 | private IUnidadMedidaRepository unidadMedidaRepository; 22 | 23 | // Consulta todos 24 | @Transactional(readOnly = true) 25 | public List findAll() { 26 | return (List) unidadMedidaRepository.findAll(Sort.by("idUnidadMedida")); 27 | } 28 | 29 | // consulta todos para paginación 30 | @Transactional(readOnly = true) 31 | public Page findAllPage(Pageable pageable) { 32 | return unidadMedidaRepository.findAll(pageable); 33 | } 34 | 35 | // consulta por id 36 | @Transactional(readOnly = true) 37 | public UnidadMedida findById(Long idUnidadMedida) { 38 | return unidadMedidaRepository.findById(idUnidadMedida).orElse(null); 39 | } 40 | 41 | // Crear 42 | @Transactional 43 | public UnidadMedida createUnidadMedida(UnidadMedidaDto unidadMedida) { 44 | UnidadMedida unidadMedidaEntity = new UnidadMedida(); 45 | unidadMedidaEntity.setUnidadMedida(unidadMedida.unidadMedida()); 46 | return unidadMedidaRepository.save(unidadMedidaEntity); 47 | } 48 | 49 | // Eliminar 50 | public UnidadMedida deleteUnidadMedida(Long idUnidadMedida) { 51 | unidadMedidaRepository.deleteById(idUnidadMedida); 52 | return null; 53 | } 54 | 55 | // Modificar 56 | @Transactional 57 | public UnidadMedida updateUnidadMedida(Long idUnidadMedida, UnidadMedidaDto unidadMedida) { 58 | UnidadMedida unidadMedidaEntity = unidadMedidaRepository.findById(idUnidadMedida).orElseThrow( 59 | () -> new NoSuchElementException("Unidad de Medida no encontrada con el ID: " + idUnidadMedida)); 60 | unidadMedidaEntity.setUnidadMedida(unidadMedida.unidadMedida()); 61 | return unidadMedidaRepository.save(unidadMedidaEntity); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/service/EstatusOrdenService.java: -------------------------------------------------------------------------------- 1 | package com.inventory.service; 2 | 3 | import java.util.List; 4 | import java.util.NoSuchElementException; 5 | 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.data.domain.Page; 8 | import org.springframework.data.domain.Pageable; 9 | import org.springframework.data.domain.Sort; 10 | import org.springframework.stereotype.Service; 11 | import org.springframework.transaction.annotation.Transactional; 12 | 13 | import com.inventory.dto.EstatusOrdenDto; 14 | import com.inventory.entity.EstatusOrden; 15 | import com.inventory.repository.IEstatusOrdenRepository; 16 | 17 | @Service 18 | public class EstatusOrdenService implements IEstatusOrdenService { 19 | 20 | @Autowired 21 | private IEstatusOrdenRepository estatusOrdenRepository; 22 | 23 | // Consulta todos 24 | @Transactional(readOnly = true) 25 | public List findAll() { 26 | return (List) estatusOrdenRepository.findAll(Sort.by("idEstatusOrden")); 27 | } 28 | 29 | // consulta todos para paginación 30 | @Transactional(readOnly = true) 31 | public Page findAllPage(Pageable pageable) { 32 | return estatusOrdenRepository.findAll(pageable); 33 | } 34 | 35 | // consulta por id 36 | @Transactional(readOnly = true) 37 | public EstatusOrden findById(Long idEstatusOrden) { 38 | return estatusOrdenRepository.findById(idEstatusOrden).orElse(null); 39 | } 40 | 41 | // Crear 42 | @Transactional 43 | public EstatusOrden createEstatusOrden(EstatusOrdenDto estatusOrden) { 44 | EstatusOrden estatusOrdenEntity = new EstatusOrden(); 45 | estatusOrdenEntity.setEstatusOrden(estatusOrden.estatusOrden()); 46 | return estatusOrdenRepository.save(estatusOrdenEntity); 47 | } 48 | 49 | // Eliminar 50 | public EstatusOrden deleteEstatusOrden(Long idEstatusOrden) { 51 | estatusOrdenRepository.deleteById(idEstatusOrden); 52 | return null; 53 | } 54 | 55 | // Modificar 56 | @Transactional 57 | public EstatusOrden updateEstatusOrden(Long idEstatusOrden, EstatusOrdenDto estatusOrden) { 58 | EstatusOrden estatusOrdenEntity = estatusOrdenRepository.findById(idEstatusOrden) 59 | .orElseThrow(() -> new NoSuchElementException("Estatus de Orden de Compra no encontrado con el ID: " + idEstatusOrden)); 60 | estatusOrdenEntity.setEstatusOrden(estatusOrden.estatusOrden()); 61 | return estatusOrdenRepository.save(estatusOrdenEntity); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/entity/Marca.java: -------------------------------------------------------------------------------- 1 | package com.inventory.entity; 2 | 3 | import jakarta.persistence.Column; 4 | import jakarta.persistence.Entity; 5 | import jakarta.persistence.GeneratedValue; 6 | import jakarta.persistence.GenerationType; 7 | import jakarta.persistence.Id; 8 | import jakarta.persistence.Table; 9 | 10 | /** 11 | * Representa una marca en el sistema de inventario. 12 | * Esta entidad mapea la tabla 'marcas' en la base de datos y contiene información 13 | * relevante para identificar una marca. 14 | * 15 | * Atributos de la entidad: 16 | * - {@link #idMarca}: ID único para la marca. 17 | * - {@link #marca}: Nombre de la marca. 18 | * 19 | * Esta clase proporciona métodos para acceder y modificar sus atributos. 20 | */ 21 | @Entity 22 | @Table(name = "marcas") 23 | public class Marca { 24 | 25 | /** 26 | * ID único para cada marca. 27 | */ 28 | @Id 29 | @GeneratedValue(strategy = GenerationType.IDENTITY) 30 | @Column(name = "id_marca") 31 | private long idMarca; 32 | 33 | /** 34 | * Nombre de la marca. 35 | */ 36 | private String marca; 37 | 38 | /** 39 | * Constructor sin argumentos. 40 | * Inicializa una instancia de {@code Marca} con valores por defecto. 41 | */ 42 | public Marca() { 43 | super(); 44 | } 45 | 46 | /** 47 | * Constructor con parámetros. 48 | * 49 | * @param idMarca ID de la marca. 50 | * @param marca Nombre de la marca. 51 | */ 52 | public Marca(long idMarca, String marca) { 53 | super(); 54 | this.idMarca = idMarca; 55 | this.marca = marca; 56 | } 57 | 58 | /** 59 | * Obtiene el ID de la marca. 60 | * 61 | * @return el ID de la marca. 62 | */ 63 | public long getIdMarca() { 64 | return idMarca; 65 | } 66 | 67 | /** 68 | * Establece el ID de la marca. 69 | * 70 | * @param idMarca el nuevo ID para la marca. 71 | */ 72 | public void setIdMarca(long idMarca) { 73 | this.idMarca = idMarca; 74 | } 75 | 76 | /** 77 | * Obtiene el nombre de la marca. 78 | * 79 | * @return el nombre de la marca. 80 | */ 81 | public String getMarca() { 82 | return marca; 83 | } 84 | 85 | /** 86 | * Establece el nombre de la marca. 87 | * 88 | * @param marca el nuevo nombre de la marca. 89 | */ 90 | public void setMarca(String marca) { 91 | this.marca = marca; 92 | } 93 | } -------------------------------------------------------------------------------- /src/main/java/com/inventory/service/TipoMovimientoService.java: -------------------------------------------------------------------------------- 1 | package com.inventory.service; 2 | 3 | import java.util.List; 4 | import java.util.NoSuchElementException; 5 | 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.data.domain.Page; 8 | import org.springframework.data.domain.Pageable; 9 | import org.springframework.data.domain.Sort; 10 | import org.springframework.stereotype.Service; 11 | import org.springframework.transaction.annotation.Transactional; 12 | 13 | import com.inventory.dto.TipoMovimientoDto; 14 | import com.inventory.entity.TipoMovimiento; 15 | import com.inventory.repository.ITipoMovimientoRepository; 16 | 17 | @Service 18 | public class TipoMovimientoService implements ITipoMovimientoService { 19 | 20 | @Autowired 21 | private ITipoMovimientoRepository tipoMovimientoRepository; 22 | 23 | // Consulta todos 24 | @Transactional(readOnly = true) 25 | public List findAll() { 26 | return (List) tipoMovimientoRepository.findAll(Sort.by("idTipoMovimiento")); 27 | } 28 | 29 | // consulta todos para paginación 30 | @Transactional(readOnly = true) 31 | public Page findAllPage(Pageable pageable) { 32 | return tipoMovimientoRepository.findAll(pageable); 33 | } 34 | 35 | // consulta por id 36 | @Transactional(readOnly = true) 37 | public TipoMovimiento findById(Long idTipoMovimiento) { 38 | return tipoMovimientoRepository.findById(idTipoMovimiento).orElse(null); 39 | } 40 | 41 | // Crear 42 | @Transactional 43 | public TipoMovimiento createTipoMovimiento(TipoMovimientoDto tipoMovimiento) { 44 | TipoMovimiento tipoMovimientoEntity = new TipoMovimiento(); 45 | tipoMovimientoEntity.setTipoMovimiento(tipoMovimiento.tipoMovimiento()); 46 | return tipoMovimientoRepository.save(tipoMovimientoEntity); 47 | } 48 | 49 | // Eliminar 50 | public TipoMovimiento deleteTipoMovimiento(Long idTipoMovimiento) { 51 | tipoMovimientoRepository.deleteById(idTipoMovimiento); 52 | return null; 53 | } 54 | 55 | // Modificar 56 | @Transactional 57 | public TipoMovimiento updateTipoMovimiento(Long idTipoMovimiento, TipoMovimientoDto tipoMovimiento) { 58 | TipoMovimiento tipoMovimientoEntity = tipoMovimientoRepository.findById(idTipoMovimiento) 59 | .orElseThrow(() -> new NoSuchElementException( 60 | "Tipo de Movimiento no encontrado con el ID: " + idTipoMovimiento)); 61 | tipoMovimientoEntity.setTipoMovimiento(tipoMovimiento.tipoMovimiento()); 62 | return tipoMovimientoRepository.save(tipoMovimientoEntity); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/service/IProductoService.java: -------------------------------------------------------------------------------- 1 | package com.inventory.service; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.data.domain.Page; 6 | import org.springframework.data.domain.Pageable; 7 | 8 | import com.inventory.dto.ProductoDto; 9 | import com.inventory.dto.ProductoSimplificadoDto; 10 | import com.inventory.entity.Producto; 11 | 12 | /** 13 | * Interface de servicio que define las operaciones para la entidad {@link Producto}. 14 | * Métodos incluidos: 15 | * - Búsqueda de todas los productos. 16 | * - Paginación. 17 | * - Creación, eliminación y actualización de productos. 18 | */ 19 | public interface IProductoService { 20 | /** 21 | * Consulta todas las productos. 22 | * 23 | * @return una lista con todas las productos. 24 | */ 25 | //List findAll(); 26 | List obtenerTodosLosProductos(); 27 | 28 | /** 29 | * Consulta todas las productos con paginación. 30 | * 31 | * @param pageable objeto de paginación que contiene página, tamaño, etc. 32 | * @return una página con productos. 33 | */ 34 | Page obtenerProductosPaginados(Pageable pageable); 35 | 36 | //Page findAllPage(Pageable pageable); 37 | 38 | /** 39 | * Busca un producto por su ID. 40 | * 41 | * @param idproducto ID del producto a buscar. 42 | * @return el producto encontrado o null si no existe. 43 | */ 44 | Producto findById(Long idProducto); 45 | 46 | 47 | ProductoSimplificadoDto obtenerProductoPorId(Long idProducto); 48 | 49 | /** 50 | * Crea un nuevo producto. 51 | * 52 | * @param producto DTO del producto a crear. 53 | * @return el producto creado. 54 | */ 55 | Producto createProducto2(ProductoDto producto); 56 | 57 | Producto createProducto(Producto producto, Long combinacionAtributosId, int cantidadInicial); 58 | 59 | /** 60 | * Elimina un producto por su ID. 61 | * 62 | * @param idproducto ID del producto a eliminar. 63 | * @return el producto eliminado o null si no existe. 64 | */ 65 | Producto deleteProducto(Long idProducto); 66 | 67 | /** 68 | * Actualiza un producto existente. 69 | * 70 | * @param idproducto ID del producto a actualizar. 71 | * @param producto DTO del producto con la información actualizada. 72 | * @return el producto actualizada. 73 | */ 74 | Producto updateProducto(Long idProducto, ProductoDto producto); 75 | 76 | //total productos 77 | long countProductos(); 78 | } 79 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/entity/EstatusOrden.java: -------------------------------------------------------------------------------- 1 | package com.inventory.entity; 2 | 3 | import jakarta.persistence.Column; 4 | import jakarta.persistence.Entity; 5 | import jakarta.persistence.GeneratedValue; 6 | import jakarta.persistence.GenerationType; 7 | import jakarta.persistence.Id; 8 | import jakarta.persistence.Table; 9 | 10 | /** 11 | * Representa el estatus de una orden de compra en el sistema de inventario. 12 | * Esta entidad define los distintos estados que puede tener una orden de compra, tales como "Pendiente", "En proceso", "Completada", etc. 13 | * Cada estatus tiene un identificador único y un nombre descriptivo. 14 | * 15 | * @autor RBaume 16 | */ 17 | @Entity 18 | @Table(name="estatusOrdenes") 19 | public class EstatusOrden { 20 | 21 | @Id 22 | @GeneratedValue(strategy = GenerationType.IDENTITY) 23 | @Column(name = "id_estatus_orden") 24 | private long idEstatusOrden; 25 | 26 | private String estatusOrden; 27 | 28 | /** 29 | * Constructor vacío necesario para JPA. 30 | */ 31 | public EstatusOrden() { 32 | super(); 33 | } 34 | 35 | /** 36 | * Constructor que permite crear un estatus de orden con todos sus atributos. 37 | * 38 | * @param idEstatusOrden Identificador único del estatus de la orden 39 | * @param estatusOrden Nombre descriptivo del estatus de la orden 40 | */ 41 | public EstatusOrden(long idEstatusOrden, String estatusOrden) { 42 | super(); 43 | this.idEstatusOrden = idEstatusOrden; 44 | this.estatusOrden = estatusOrden; 45 | } 46 | 47 | /** 48 | * Obtiene el identificador del estatus de la orden. 49 | * 50 | * @return id del estatus de la orden 51 | */ 52 | public long getIdEstatusOrden() { 53 | return idEstatusOrden; 54 | } 55 | 56 | /** 57 | * Asigna el identificador del estatus de la orden. 58 | * 59 | * @param idEstatusOrden id del estatus de la orden 60 | */ 61 | public void setIdEstatusOrden(long idEstatusOrden) { 62 | this.idEstatusOrden = idEstatusOrden; 63 | } 64 | 65 | /** 66 | * Obtiene el nombre descriptivo del estatus de la orden. 67 | * 68 | * @return nombre del estatus de la orden 69 | */ 70 | public String getEstatusOrden() { 71 | return estatusOrden; 72 | } 73 | 74 | /** 75 | * Asigna el nombre descriptivo del estatus de la orden. 76 | * 77 | * @param estatusOrden nombre del estatus de la orden 78 | */ 79 | public void setEstatusOrden(String estatusOrden) { 80 | this.estatusOrden = estatusOrden; 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/service/GrupoService.java: -------------------------------------------------------------------------------- 1 | package com.inventory.service; 2 | 3 | 4 | import java.util.List; 5 | import java.util.NoSuchElementException; 6 | 7 | import org.springframework.beans.factory.annotation.Autowired; 8 | import org.springframework.data.domain.Page; 9 | import org.springframework.data.domain.Pageable; 10 | import org.springframework.data.domain.Sort; 11 | import org.springframework.stereotype.Service; 12 | import org.springframework.transaction.annotation.Transactional; 13 | 14 | import com.inventory.dto.GrupoDto; 15 | import com.inventory.entity.Grupo; 16 | import com.inventory.repository.IGrupoRepository; 17 | 18 | import jakarta.persistence.EntityNotFoundException; 19 | 20 | @Service 21 | public class GrupoService implements IGrupoService{ 22 | 23 | @Autowired 24 | private IGrupoRepository grupoRepository; 25 | 26 | 27 | // Consulta todos 28 | @Transactional(readOnly = true) 29 | public List findAll() { 30 | return (List) grupoRepository.findAll(Sort.by("idGrupo")); 31 | } 32 | 33 | // consulta todos para paginación 34 | @Transactional(readOnly = true) 35 | public Page findAllPage(Pageable pageable) { 36 | return grupoRepository.findAll(pageable); 37 | } 38 | 39 | // consulta por id 40 | @Transactional(readOnly = true) 41 | public Grupo findById(Long idGrupo) { 42 | return grupoRepository.findById(idGrupo).orElse(null); 43 | } 44 | 45 | // Crear 46 | @Transactional 47 | public Grupo createGrupo(GrupoDto grupo) { 48 | Grupo grupoEntity = new Grupo(); 49 | grupoEntity.setNombreGrupo(grupo.nombreGrupo()); 50 | grupoEntity.setStatus(grupo.status()); 51 | return grupoRepository.save(grupoEntity); 52 | } 53 | 54 | // Eliminar 55 | public Grupo deleteGrupo(Long idGrupo) { 56 | grupoRepository.deleteById(idGrupo); 57 | return null; 58 | } 59 | 60 | // Modificar 61 | @Transactional 62 | public Grupo updateGrupo(Long idGrupo, GrupoDto grupo) { 63 | Grupo grupoEntity = grupoRepository.findById(idGrupo).orElseThrow( 64 | () -> new NoSuchElementException("Grupo no encontrado con el ID: " + idGrupo)); 65 | grupoEntity.setNombreGrupo(grupo.nombreGrupo()); 66 | grupoEntity.setStatus(grupo.status()); 67 | return grupoRepository.save(grupoEntity); 68 | } 69 | 70 | 71 | 72 | 73 | public GrupoDto obtenerGrupoCompleto(Long idGrupo) { 74 | Grupo grupo = grupoRepository.findById(idGrupo) 75 | .orElseThrow(() -> new EntityNotFoundException("Grupo con ID " + idGrupo + " no encontrado")); 76 | 77 | // Forzar inicialización de relaciones 78 | grupo.getAtributos().forEach(atributo -> atributo.getValores().size()); 79 | 80 | return new GrupoDto(grupo); 81 | } 82 | 83 | 84 | 85 | } 86 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/security/JwtGenerador.java: -------------------------------------------------------------------------------- 1 | package com.inventory.security; 2 | 3 | import java.util.Date; 4 | 5 | import org.springframework.security.authentication.AuthenticationCredentialsNotFoundException; 6 | import org.springframework.security.core.Authentication; 7 | import org.springframework.stereotype.Component; 8 | 9 | import io.jsonwebtoken.Claims; 10 | import io.jsonwebtoken.Jwts; 11 | import io.jsonwebtoken.SignatureAlgorithm; 12 | 13 | @Component 14 | public class JwtGenerador { 15 | // Método para crear un token por medio de la autentificación 16 | public String generarToken(Authentication authentication) { 17 | String username = authentication.getName(); 18 | Date tiempoActual = new Date(); 19 | Date expiracionToken = new Date(tiempoActual.getTime() + ConstantesSeguridad.JWT_EXPIRATION_TOKEN); 20 | 21 | // Línea para generar el token 22 | String token = Jwts.builder() //Construimos un token JWT llamado token 23 | .setSubject(username) //Aca establecemos el nombre de usuario que está iniciando sesión 24 | .setIssuedAt(new Date()) //Establecemos la fecha de emisión del token en el momento actual 25 | .setExpiration(expiracionToken) //Establecemos la fecha de caducidad del token 26 | .signWith(SignatureAlgorithm.HS512, ConstantesSeguridad.JWT_FIRMA) /* Utilizamos este método para firmar 27 | nuestro token y de esta manera evitar la manipulación o modificación de este*/ 28 | .compact(); //Este método finaliza la construcción del token y lo convierte en una cadena compacta 29 | 30 | return token; 31 | } 32 | 33 | // Método para extraer un username a partir de un token 34 | public String obtenerUsernameDeJwt(String token) { 35 | Claims claims = Jwts.parser() //El método parser se utiliza con el fin de analizar el token 36 | .setSigningKey(ConstantesSeguridad.JWT_FIRMA) //Establece la clave de firma, que se utiliza para verificar la firma del token 37 | .parseClaimsJws(token) //Se utiliza para verificar la firma del token, apartir del String "token" 38 | .getBody(); /*Obtenemos el claims(cuerpo) ya verificado del token el cual contendrá la información de 39 | nombre de usuario, fecha de expiración y firma del token*/ 40 | return claims.getSubject(); //Devolvemos el nombre de usuario 41 | } 42 | 43 | // Método para validar el token 44 | public Boolean validarToken(String token) { 45 | try { 46 | //Validación del token por medio de la firma que contiene el String token (token) 47 | //Si son idénticas validará el token o caso contrario saltará la excepción de abajo 48 | Jwts.parser().setSigningKey(ConstantesSeguridad.JWT_FIRMA).parseClaimsJws(token); 49 | return true; 50 | } catch (Exception e) { 51 | throw new AuthenticationCredentialsNotFoundException("401"); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /doc/com/inventory/package-use.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Uses of Package com.inventory 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 20 | 23 |
24 | 47 |
48 |
49 |
50 |

Uses of Package
com.inventory

51 |
52 | No usage of com.inventory
53 | 54 | 55 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/service/UbicacionService.java: -------------------------------------------------------------------------------- 1 | package com.inventory.service; 2 | 3 | import java.util.List; 4 | import java.util.NoSuchElementException; 5 | 6 | import org.springframework.beans.factory.annotation.Autowired; 7 | import org.springframework.data.domain.Page; 8 | import org.springframework.data.domain.Pageable; 9 | import org.springframework.data.domain.Sort; 10 | import org.springframework.stereotype.Service; 11 | import org.springframework.transaction.annotation.Transactional; 12 | 13 | import com.inventory.dto.UbicacionDto; 14 | import com.inventory.entity.Ubicacion; 15 | import com.inventory.repository.IUbicacionRepository; 16 | 17 | @Service 18 | public class UbicacionService implements IUbicacionService { 19 | 20 | @Autowired 21 | private IUbicacionRepository ubicacionRepository; 22 | 23 | // Consulta todos 24 | @Transactional(readOnly = true) 25 | public List findAll() { 26 | return (List) ubicacionRepository.findAll(Sort.by("idUbicacion")); 27 | } 28 | 29 | // consulta todos para paginación 30 | @Transactional(readOnly = true) 31 | public Page findAllPage(Pageable pageable) { 32 | return ubicacionRepository.findAll(pageable); 33 | } 34 | 35 | // consulta por id 36 | @Transactional(readOnly = true) 37 | public Ubicacion findById(Long idUbicacion) { 38 | return ubicacionRepository.findById(idUbicacion).orElse(null); 39 | } 40 | 41 | // Crear 42 | @Transactional 43 | public Ubicacion createUbicacion(UbicacionDto ubicacion) { 44 | Ubicacion ubicacionEntity = new Ubicacion(); 45 | ubicacionEntity.setNombreUbicacion(ubicacion.nombreUbicacion()); 46 | ubicacionEntity.setDireccionUbicacion(ubicacion.direccionUbicacion()); 47 | ubicacionEntity.setTelefono(ubicacion.telefono()); 48 | ubicacionEntity.setResponsable(ubicacion.responsable()); 49 | return ubicacionRepository.save(ubicacionEntity); 50 | } 51 | 52 | // Eliminar 53 | public Ubicacion deleteUbicacion(Long idUbicacion) { 54 | ubicacionRepository.deleteById(idUbicacion); 55 | return null; 56 | } 57 | 58 | // Modificar 59 | @Transactional 60 | public Ubicacion updateUbicacion(Long idUbicacion, UbicacionDto ubicacion) { 61 | Ubicacion ubicacionEntity = ubicacionRepository.findById(idUbicacion) 62 | .orElseThrow(() -> new NoSuchElementException("Ubicacion no encontrada con el ID: " + idUbicacion)); 63 | ubicacionEntity.setNombreUbicacion(ubicacion.nombreUbicacion()); 64 | ubicacionEntity.setDireccionUbicacion(ubicacion.direccionUbicacion()); 65 | ubicacionEntity.setTelefono(ubicacion.telefono()); 66 | ubicacionEntity.setResponsable(ubicacion.responsable()); 67 | return ubicacionRepository.save(ubicacionEntity); 68 | } 69 | 70 | // total de ubicaciones 71 | public long countUbicaciones() { 72 | return ubicacionRepository.count(); 73 | } 74 | 75 | } -------------------------------------------------------------------------------- /doc/com/inventory/demo/package-use.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Uses of Package com.inventory.demo 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 20 | 23 |
24 | 47 |
48 |
49 |
50 |

Uses of Package
com.inventory.demo

51 |
52 | No usage of com.inventory.demo
53 | 54 | 55 | -------------------------------------------------------------------------------- /doc/com/inventory/controller/package-use.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Uses of Package com.inventory.controller 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 20 | 23 |
24 | 47 |
48 |
49 |
50 |

Uses of Package
com.inventory.controller

51 |
52 | No usage of com.inventory.controller
53 | 54 | 55 | -------------------------------------------------------------------------------- /doc/com/inventory/demo/package-tree.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.inventory.demo Class Hierarchy 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 20 | 23 |
24 | 47 |
48 |
49 |
50 |

Hierarchy For Package com.inventory.demo

51 |
52 | Package Hierarchies: 53 | 56 |
57 | 58 | 59 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/entity/Proveedor.java: -------------------------------------------------------------------------------- 1 | package com.inventory.entity; 2 | 3 | 4 | import org.hibernate.annotations.Filter; 5 | import org.hibernate.annotations.FilterDef; 6 | import org.hibernate.annotations.ParamDef; 7 | import org.hibernate.annotations.SQLDelete; 8 | 9 | import jakarta.persistence.Column; 10 | import jakarta.persistence.Entity; 11 | import jakarta.persistence.GeneratedValue; 12 | import jakarta.persistence.GenerationType; 13 | import jakarta.persistence.Id; 14 | import jakarta.persistence.Table; 15 | 16 | @Entity 17 | @Table(name="proveedores") 18 | @SQLDelete(sql = "UPDATE proveedores SET deleted = true WHERE id_proveedor=?") 19 | @FilterDef(name = "deletedProveedoresFilter", parameters = @ParamDef(name = "isDeleted", type = org.hibernate.type.descriptor.java.BooleanJavaType.class)) 20 | @Filter(name = "deletedProveedoresFilter", condition = "deleted = :isDeleted") 21 | public class Proveedor { 22 | @Id 23 | @GeneratedValue(strategy = GenerationType.IDENTITY) 24 | @Column(name = "id_proveedor") 25 | private long idProveedor; 26 | private String nombreProveedor; 27 | private String direccionProveedor; 28 | private String telefonoProveedor; 29 | private String emailProveedor; 30 | private boolean deleted = Boolean.FALSE; 31 | 32 | public Proveedor() { 33 | super(); 34 | } 35 | 36 | public Proveedor(long idProveedor, String nombreProveedor, String direccionProveedor, String telefonoProveedor, 37 | String emailProveedor, boolean deleted) { 38 | super(); 39 | this.idProveedor = idProveedor; 40 | this.nombreProveedor = nombreProveedor; 41 | this.direccionProveedor = direccionProveedor; 42 | this.telefonoProveedor = telefonoProveedor; 43 | this.emailProveedor = emailProveedor; 44 | this.deleted = deleted; 45 | } 46 | 47 | public long getIdProveedor() { 48 | return idProveedor; 49 | } 50 | 51 | public void setIdProveedor(long idProveedor) { 52 | this.idProveedor = idProveedor; 53 | } 54 | 55 | public String getNombreProveedor() { 56 | return nombreProveedor; 57 | } 58 | 59 | public void setNombreProveedor(String nombreProveedor) { 60 | this.nombreProveedor = nombreProveedor; 61 | } 62 | 63 | public String getDireccionProveedor() { 64 | return direccionProveedor; 65 | } 66 | 67 | public void setDireccionProveedor(String direccionProveedor) { 68 | this.direccionProveedor = direccionProveedor; 69 | } 70 | 71 | public String getTelefonoProveedor() { 72 | return telefonoProveedor; 73 | } 74 | 75 | public void setTelefonoProveedor(String telefonoProveedor) { 76 | this.telefonoProveedor = telefonoProveedor; 77 | } 78 | 79 | public String getEmailProveedor() { 80 | return emailProveedor; 81 | } 82 | 83 | public void setEmailProveedor(String emailProveedor) { 84 | this.emailProveedor = emailProveedor; 85 | } 86 | 87 | public boolean isDeleted() { 88 | return deleted; 89 | } 90 | 91 | public void setDeleted(boolean deleted) { 92 | this.deleted = deleted; 93 | } 94 | 95 | } 96 | -------------------------------------------------------------------------------- /src/main/java/com/inventory/service/CombinacionAtributosService.java: -------------------------------------------------------------------------------- 1 | package com.inventory.service; 2 | 3 | import java.util.List; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.stereotype.Service; 7 | 8 | import com.inventory.entity.CombinacionAtributos; 9 | import com.inventory.entity.CombinacionValorAtributo; 10 | import com.inventory.entity.Grupo; 11 | import com.inventory.entity.ValorAtributo; 12 | import com.inventory.repository.ICombinacionAtributosRepository; 13 | import com.inventory.repository.ICombinacionValorAtributoRepository; 14 | import com.inventory.repository.IGrupoRepository; 15 | import com.inventory.repository.IValorAtributoRepository; 16 | 17 | import jakarta.transaction.Transactional; 18 | 19 | @Service 20 | public class CombinacionAtributosService implements ICombinacionAtributosService{ 21 | 22 | @Autowired 23 | private IGrupoRepository grupoRepository; 24 | 25 | @Autowired 26 | private ICombinacionAtributosRepository combinacionAtributosRepository; 27 | 28 | @Autowired 29 | private IValorAtributoRepository valorAtributoRepository; 30 | 31 | @Autowired 32 | private ICombinacionValorAtributoRepository combinacionValorAtributoRepository; 33 | 34 | /** 35 | * Crea una nueva combinación de atributos asociada a un grupo y agrega valores de atributo seleccionados. 36 | * 37 | * @param grupoId ID del grupo al que pertenece la combinación de atributos 38 | * @param valorAtributoIds Lista de IDs de los valores de atributos para asociar con la combinación 39 | * @return La combinación de atributos creada o null si el grupo no existe 40 | */ 41 | @Transactional 42 | public CombinacionAtributos createCombinacion(Long grupoId, List valorAtributoIds) { 43 | // Buscar el grupo por su ID 44 | Grupo grupo = grupoRepository.findById(grupoId).orElse(null); 45 | 46 | if (grupo == null) { 47 | return null; // Retornar null si no se encuentra el grupo 48 | } 49 | 50 | // Crear la combinación de atributos y asociarla al grupo 51 | CombinacionAtributos combinacion = new CombinacionAtributos(); 52 | combinacion.setGrupo(grupo); 53 | CombinacionAtributos savedCombinacion = combinacionAtributosRepository.save(combinacion); 54 | 55 | // Asociar los valores de atributo a la combinación 56 | for (Long valorId : valorAtributoIds) { 57 | ValorAtributo valor = valorAtributoRepository.findById(valorId).orElse(null); 58 | if (valor != null) { 59 | CombinacionValorAtributo combinacionValorAtributo = new CombinacionValorAtributo(); 60 | combinacionValorAtributo.setCombinacionAtributos(savedCombinacion); 61 | combinacionValorAtributo.setValorAtributo(valor); 62 | combinacionValorAtributoRepository.save(combinacionValorAtributo); 63 | } 64 | } 65 | 66 | return savedCombinacion; 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /doc/com/inventory/entity/class-use/Movimientos.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Uses of Class com.inventory.entity.Movimientos 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 20 | 23 |
24 | 47 |
48 |
49 |
50 |

Uses of Class
com.inventory.entity.Movimientos

51 |
52 | No usage of com.inventory.entity.Movimientos
53 | 54 | 55 | -------------------------------------------------------------------------------- /doc/com/inventory/service/class-use/RolService.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Uses of Class com.inventory.service.RolService 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 20 | 23 |
24 | 47 |
48 |
49 |
50 |

Uses of Class
com.inventory.service.RolService

51 |
52 | No usage of com.inventory.service.RolService
53 | 54 | 55 | -------------------------------------------------------------------------------- /doc/com/inventory/service/class-use/MarcaService.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Uses of Class com.inventory.service.MarcaService 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 20 | 23 |
24 | 47 |
48 |
49 |
50 |

Uses of Class
com.inventory.service.MarcaService

51 |
52 | No usage of com.inventory.service.MarcaService
53 | 54 | 55 | -------------------------------------------------------------------------------- /doc/com/inventory/service/class-use/AlmacenService.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Uses of Class com.inventory.service.AlmacenService 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 20 | 23 |
24 | 47 |
48 |
49 |
50 |

Uses of Class
com.inventory.service.AlmacenService

51 |
52 | No usage of com.inventory.service.AlmacenService
53 | 54 | 55 | -------------------------------------------------------------------------------- /doc/com/inventory/service/class-use/UsuarioService.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Uses of Class com.inventory.service.UsuarioService 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 20 | 23 |
24 | 47 |
48 |
49 |
50 |

Uses of Class
com.inventory.service.UsuarioService

51 |
52 | No usage of com.inventory.service.UsuarioService
53 | 54 | 55 | -------------------------------------------------------------------------------- /doc/com/inventory/entity/class-use/ProductoAtributo.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Uses of Class com.inventory.entity.ProductoAtributo 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 20 | 23 |
24 | 47 |
48 |
49 |
50 |

Uses of Class
com.inventory.entity.ProductoAtributo

51 |
52 | No usage of com.inventory.entity.ProductoAtributo
53 | 54 | 55 | -------------------------------------------------------------------------------- /doc/com/inventory/security/class-use/SecurityConfig.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Uses of Class com.inventory.security.SecurityConfig 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 20 | 23 |
24 | 47 |
48 |
49 |
50 |

Uses of Class
com.inventory.security.SecurityConfig

51 |
52 | No usage of com.inventory.security.SecurityConfig
53 | 54 | 55 | -------------------------------------------------------------------------------- /doc/com/inventory/service/class-use/ProductoService.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Uses of Class com.inventory.service.ProductoService 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 20 | 23 |
24 | 47 |
48 |
49 |
50 |

Uses of Class
com.inventory.service.ProductoService

51 |
52 | No usage of com.inventory.service.ProductoService
53 | 54 | 55 | -------------------------------------------------------------------------------- /doc/com/inventory/controller/class-use/RolController.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Uses of Class com.inventory.controller.RolController 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 20 | 23 |
24 | 47 |
48 |
49 |
50 |

Uses of Class
com.inventory.controller.RolController

51 |
52 | No usage of com.inventory.controller.RolController
53 | 54 | 55 | -------------------------------------------------------------------------------- /doc/com/inventory/service/class-use/CategoriaService.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Uses of Class com.inventory.service.CategoriaService 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 20 | 23 |
24 | 47 |
48 |
49 |
50 |

Uses of Class
com.inventory.service.CategoriaService

51 |
52 | No usage of com.inventory.service.CategoriaService
53 | 54 | 55 | -------------------------------------------------------------------------------- /doc/com/inventory/service/class-use/ProveedorService.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Uses of Class com.inventory.service.ProveedorService 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 20 | 23 |
24 | 47 |
48 |
49 |
50 |

Uses of Class
com.inventory.service.ProveedorService

51 |
52 | No usage of com.inventory.service.ProveedorService
53 | 54 | 55 | -------------------------------------------------------------------------------- /doc/com/inventory/service/class-use/UbicacionService.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Uses of Class com.inventory.service.UbicacionService 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 20 | 23 |
24 | 47 |
48 |
49 |
50 |

Uses of Class
com.inventory.service.UbicacionService

51 |
52 | No usage of com.inventory.service.UbicacionService
53 | 54 | 55 | -------------------------------------------------------------------------------- /doc/com/inventory/entity/class-use/DetalleOrdenCompra.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Uses of Class com.inventory.entity.DetalleOrdenCompra 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 20 | 23 |
24 | 47 |
48 |
49 |
50 |

Uses of Class
com.inventory.entity.DetalleOrdenCompra

51 |
52 | No usage of com.inventory.entity.DetalleOrdenCompra
53 | 54 | 55 | -------------------------------------------------------------------------------- /doc/com/inventory/controller/class-use/MarcaController.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Uses of Class com.inventory.controller.MarcaController 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 20 | 23 |
24 | 47 |
48 |
49 |
50 |

Uses of Class
com.inventory.controller.MarcaController

51 |
52 | No usage of com.inventory.controller.MarcaController
53 | 54 | 55 | -------------------------------------------------------------------------------- /doc/com/inventory/service/class-use/EstatusOrdenService.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Uses of Class com.inventory.service.EstatusOrdenService 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 20 | 23 |
24 | 47 |
48 |
49 |
50 |

Uses of Class
com.inventory.service.EstatusOrdenService

51 |
52 | No usage of com.inventory.service.EstatusOrdenService
53 | 54 | 55 | -------------------------------------------------------------------------------- /doc/com/inventory/service/class-use/TipoProductoService.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Uses of Class com.inventory.service.TipoProductoService 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 20 | 23 |
24 | 47 |
48 |
49 |
50 |

Uses of Class
com.inventory.service.TipoProductoService

51 |
52 | No usage of com.inventory.service.TipoProductoService
53 | 54 | 55 | -------------------------------------------------------------------------------- /doc/com/inventory/service/class-use/UnidadMedidaService.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Uses of Class com.inventory.service.UnidadMedidaService 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 20 | 23 |
24 | 47 |
48 |
49 |
50 |

Uses of Class
com.inventory.service.UnidadMedidaService

51 |
52 | No usage of com.inventory.service.UnidadMedidaService
53 | 54 | 55 | -------------------------------------------------------------------------------- /doc/com/inventory/controller/class-use/AlmacenController.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Uses of Class com.inventory.controller.AlmacenController 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 20 | 23 |
24 | 47 |
48 |
49 |
50 |

Uses of Class
com.inventory.controller.AlmacenController

51 |
52 | No usage of com.inventory.controller.AlmacenController
53 | 54 | 55 | -------------------------------------------------------------------------------- /doc/com/inventory/controller/class-use/UsuarioController.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Uses of Class com.inventory.controller.UsuarioController 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 20 | 23 |
24 | 47 |
48 |
49 |
50 |

Uses of Class
com.inventory.controller.UsuarioController

51 |
52 | No usage of com.inventory.controller.UsuarioController
53 | 54 | 55 | -------------------------------------------------------------------------------- /doc/com/inventory/security/class-use/ConstantesSeguridad.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Uses of Class com.inventory.security.ConstantesSeguridad 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 20 | 23 |
24 | 47 |
48 |
49 |
50 |

Uses of Class
com.inventory.security.ConstantesSeguridad

51 |
52 | No usage of com.inventory.security.ConstantesSeguridad
53 | 54 | 55 | -------------------------------------------------------------------------------- /doc/com/inventory/controller/class-use/ProductoController.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Uses of Class com.inventory.controller.ProductoController 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 20 | 23 |
24 | 47 |
48 |
49 |
50 |

Uses of Class
com.inventory.controller.ProductoController

51 |
52 | No usage of com.inventory.controller.ProductoController
53 | 54 | 55 | -------------------------------------------------------------------------------- /doc/com/inventory/controller/class-use/RestAuthController.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Uses of Class com.inventory.controller.RestAuthController 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 20 | 23 |
24 | 47 |
48 |
49 |
50 |

Uses of Class
com.inventory.controller.RestAuthController

51 |
52 | No usage of com.inventory.controller.RestAuthController
53 | 54 | 55 | -------------------------------------------------------------------------------- /doc/com/inventory/service/class-use/TipoMovimientoService.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Uses of Class com.inventory.service.TipoMovimientoService 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 20 | 23 |
24 | 47 |
48 |
49 |
50 |

Uses of Class
com.inventory.service.TipoMovimientoService

51 |
52 | No usage of com.inventory.service.TipoMovimientoService
53 | 54 | 55 | -------------------------------------------------------------------------------- /doc/com/inventory/class-use/InventorySpringSecurityApplication.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Uses of Class com.inventory.InventorySpringSecurityApplication 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 20 | 23 |
24 | 47 |
48 |
49 |
50 |

Uses of Class
com.inventory.InventorySpringSecurityApplication

51 |
52 | No usage of com.inventory.InventorySpringSecurityApplication
53 | 54 | 55 | --------------------------------------------------------------------------------