From 67338ff09cede31c3e4fcdcf89b883983a143a54 Mon Sep 17 00:00:00 2001 From: Mayol Jose Date: Fri, 23 Apr 2021 20:58:41 -0300 Subject: [PATCH 01/11] Primeras aproximaciones a la funcionalidad de transferencia bancaria --- .../java/sic/controller/ReciboController.java | 48 ++++++++-- src/main/java/sic/modelo/EstadoRecibo.java | 7 ++ src/main/java/sic/modelo/Recibo.java | 9 ++ .../sic/modelo/dto/NuevoReciboClienteDTO.java | 21 ++++ .../modelo/dto/NuevoReciboDepositoDTO.java | 20 ++++ .../modelo/dto/NuevoReciboProveedorDTO.java | 21 ++++ .../java/sic/repository/ReciboRepository.java | 7 ++ src/main/java/sic/service/IReciboService.java | 7 ++ .../sic/service/impl/NotaServiceImpl.java | 5 + .../sic/service/impl/ReciboServiceImpl.java | 62 +++++++++++- src/main/resources/messages.properties | 6 ++ .../sic/integration/AppIntegrationTest.java | 95 +++++++++++++++---- src/test/java/sic/model/Recibo.java | 3 + src/test/resources/data.sql | 2 +- 14 files changed, 280 insertions(+), 33 deletions(-) create mode 100644 src/main/java/sic/modelo/EstadoRecibo.java create mode 100644 src/main/java/sic/modelo/dto/NuevoReciboClienteDTO.java create mode 100644 src/main/java/sic/modelo/dto/NuevoReciboDepositoDTO.java create mode 100644 src/main/java/sic/modelo/dto/NuevoReciboProveedorDTO.java diff --git a/src/main/java/sic/controller/ReciboController.java b/src/main/java/sic/controller/ReciboController.java index b284f1ad6..f04dd8ca3 100644 --- a/src/main/java/sic/controller/ReciboController.java +++ b/src/main/java/sic/controller/ReciboController.java @@ -10,9 +10,13 @@ import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import sic.aspect.AccesoRolesPermitidos; +import sic.modelo.EstadoRecibo; import sic.modelo.criteria.BusquedaReciboCriteria; import sic.modelo.Recibo; import sic.modelo.Rol; +import sic.modelo.dto.NuevoReciboClienteDTO; +import sic.modelo.dto.NuevoReciboDepositoDTO; +import sic.modelo.dto.NuevoReciboProveedorDTO; import sic.modelo.dto.ReciboDTO; import sic.service.*; import java.math.BigDecimal; @@ -71,35 +75,53 @@ public BigDecimal getTotalRecibos(@RequestBody BusquedaReciboCriteria criteria) @PostMapping("/recibos/clientes") @AccesoRolesPermitidos({Rol.ADMINISTRADOR, Rol.ENCARGADO}) public Recibo guardarReciboCliente( - @RequestBody ReciboDTO reciboDTO, + @RequestBody NuevoReciboClienteDTO nuevoReciboClienteDTO, @RequestHeader("Authorization") String authorizationHeader) { - Recibo recibo = modelMapper.map(reciboDTO, Recibo.class); - recibo.setSucursal(sucursalService.getSucursalPorId(reciboDTO.getIdSucursal())); - recibo.setCliente(clienteService.getClienteNoEliminadoPorId(reciboDTO.getIdCliente())); - recibo.setFormaDePago(formaDePagoService.getFormasDePagoNoEliminadoPorId(reciboDTO.getIdFormaDePago())); + Recibo recibo = new Recibo(); + recibo.setConcepto(nuevoReciboClienteDTO.getConcepto()); + recibo.setSucursal(sucursalService.getSucursalPorId(nuevoReciboClienteDTO.getIdSucursal())); + recibo.setCliente( + clienteService.getClienteNoEliminadoPorId(nuevoReciboClienteDTO.getIdCliente())); + recibo.setFormaDePago( + formaDePagoService.getFormasDePagoNoEliminadoPorId( + nuevoReciboClienteDTO.getIdFormaDePago())); Claims claims = authService.getClaimsDelToken(authorizationHeader); recibo.setUsuario( usuarioService.getUsuarioNoEliminadoPorId(((Integer) claims.get("idUsuario")).longValue())); recibo.setFecha(LocalDateTime.now()); + recibo.setEstado(EstadoRecibo.APROBADO); + recibo.setMonto(nuevoReciboClienteDTO.getMonto()); return reciboService.guardar(recibo); } @PostMapping("/recibos/proveedores") @AccesoRolesPermitidos({Rol.ADMINISTRADOR, Rol.ENCARGADO}) public Recibo guardarReciboProveedor( - @RequestBody ReciboDTO reciboDTO, + @RequestBody NuevoReciboProveedorDTO nuevoReciboProveedorDTO, @RequestHeader("Authorization") String authorizationHeader) { - Recibo recibo = modelMapper.map(reciboDTO, Recibo.class); - recibo.setSucursal(sucursalService.getSucursalPorId(reciboDTO.getIdSucursal())); - recibo.setProveedor(proveedorService.getProveedorNoEliminadoPorId(reciboDTO.getIdProveedor())); - recibo.setFormaDePago(formaDePagoService.getFormasDePagoNoEliminadoPorId(reciboDTO.getIdFormaDePago())); + Recibo recibo = new Recibo(); + recibo.setConcepto(nuevoReciboProveedorDTO.getConcepto()); + recibo.setSucursal(sucursalService.getSucursalPorId(nuevoReciboProveedorDTO.getIdSucursal())); + recibo.setProveedor( + proveedorService.getProveedorNoEliminadoPorId(nuevoReciboProveedorDTO.getIdProveedor())); + recibo.setFormaDePago( + formaDePagoService.getFormasDePagoNoEliminadoPorId( + nuevoReciboProveedorDTO.getIdFormaDePago())); Claims claims = authService.getClaimsDelToken(authorizationHeader); recibo.setUsuario( usuarioService.getUsuarioNoEliminadoPorId(((Integer) claims.get("idUsuario")).longValue())); recibo.setFecha(LocalDateTime.now()); + recibo.setMonto(nuevoReciboProveedorDTO.getMonto()); + recibo.setEstado(EstadoRecibo.APROBADO); return reciboService.guardar(recibo); } + @PostMapping("/recibos/clientes/depositos") + @AccesoRolesPermitidos({Rol.COMPRADOR}) + public Recibo guardarReciboPorDeposito(@RequestBody NuevoReciboDepositoDTO nuevoReciboDepositoDTO) { + return reciboService.guardarReciboPorDeposito(nuevoReciboDepositoDTO); + } + @DeleteMapping("/recibos/{idRecibo}") @AccesoRolesPermitidos({Rol.ADMINISTRADOR}) public void eliminar(@PathVariable long idRecibo) { @@ -115,4 +137,10 @@ public ResponseEntity getReporteRecibo(@PathVariable long idRecibo) { byte[] reportePDF = reciboService.getReporteRecibo(reciboService.getReciboNoEliminadoPorId(idRecibo)); return new ResponseEntity<>(reportePDF, headers, HttpStatus.OK); } + + @PutMapping("/recibos/{idRecibo}/aprobar") + @AccesoRolesPermitidos({Rol.ADMINISTRADOR, Rol.ENCARGADO}) + public void aprobarRecibo(@PathVariable long idRecibo) { + reciboService.aprobarRecibo(idRecibo); + } } diff --git a/src/main/java/sic/modelo/EstadoRecibo.java b/src/main/java/sic/modelo/EstadoRecibo.java new file mode 100644 index 000000000..92ddf81da --- /dev/null +++ b/src/main/java/sic/modelo/EstadoRecibo.java @@ -0,0 +1,7 @@ +package sic.modelo; + +public enum EstadoRecibo { + SIN_CHEQUEAR, + APROBADO, + RECHAZADO +} diff --git a/src/main/java/sic/modelo/Recibo.java b/src/main/java/sic/modelo/Recibo.java index ffc2ecdec..33e4efe58 100644 --- a/src/main/java/sic/modelo/Recibo.java +++ b/src/main/java/sic/modelo/Recibo.java @@ -75,6 +75,15 @@ public class Recibo implements Serializable { @Positive(message = "{mensaje_recibo_monto_igual_menor_cero}") private BigDecimal monto; + @Pattern( + regexp = "^https:\\/\\/res.cloudinary.com\\/.*", + message = "{mensaje_url_imagen_no_valida}") + @JsonView(Views.Comprador.class) + private String urlImagen; + + @Enumerated(EnumType.STRING) + private EstadoRecibo estado; + @JsonGetter("idFormaDePago") public long getIdFormaDePago() { return formaDePago.getIdFormaDePago(); diff --git a/src/main/java/sic/modelo/dto/NuevoReciboClienteDTO.java b/src/main/java/sic/modelo/dto/NuevoReciboClienteDTO.java new file mode 100644 index 000000000..008b39e55 --- /dev/null +++ b/src/main/java/sic/modelo/dto/NuevoReciboClienteDTO.java @@ -0,0 +1,21 @@ +package sic.modelo.dto; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.math.BigDecimal; + +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class NuevoReciboClienteDTO { + + private long idCliente; + private long idSucursal; + private long idFormaDePago; + private String concepto; + private BigDecimal monto; +} diff --git a/src/main/java/sic/modelo/dto/NuevoReciboDepositoDTO.java b/src/main/java/sic/modelo/dto/NuevoReciboDepositoDTO.java new file mode 100644 index 000000000..e62db33a9 --- /dev/null +++ b/src/main/java/sic/modelo/dto/NuevoReciboDepositoDTO.java @@ -0,0 +1,20 @@ +package sic.modelo.dto; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.math.BigDecimal; + +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class NuevoReciboDepositoDTO { + + private long idPedido; + private String concepto; + private byte[] imagen; + private BigDecimal monto; +} diff --git a/src/main/java/sic/modelo/dto/NuevoReciboProveedorDTO.java b/src/main/java/sic/modelo/dto/NuevoReciboProveedorDTO.java new file mode 100644 index 000000000..1b1b78cd1 --- /dev/null +++ b/src/main/java/sic/modelo/dto/NuevoReciboProveedorDTO.java @@ -0,0 +1,21 @@ +package sic.modelo.dto; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.math.BigDecimal; + +@Data +@AllArgsConstructor +@NoArgsConstructor +@Builder +public class NuevoReciboProveedorDTO { + + private long idProveedor; + private long idSucursal; + private long idFormaDePago; + private String concepto; + private BigDecimal monto; +} diff --git a/src/main/java/sic/repository/ReciboRepository.java b/src/main/java/sic/repository/ReciboRepository.java index 3de8f2aeb..72b080c53 100644 --- a/src/main/java/sic/repository/ReciboRepository.java +++ b/src/main/java/sic/repository/ReciboRepository.java @@ -5,10 +5,12 @@ import java.util.List; import java.util.Optional; +import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; import org.springframework.data.querydsl.QuerydslPredicateExecutor; import org.springframework.data.repository.PagingAndSortingRepository; import org.springframework.data.repository.query.Param; +import sic.modelo.EstadoRecibo; import sic.modelo.Sucursal; import sic.modelo.Recibo; @@ -98,4 +100,9 @@ BigDecimal getTotalRecibosProveedoresEntreFechas( @Param("idSucursal") long idSucursal, @Param("desde") LocalDateTime desde, @Param("hasta") LocalDateTime hasta); + + @Modifying + @Query("UPDATE Recibo r SET r.urlImagen = :urlImagen WHERE r.idRecibo = :idRecibo") + int actualizarUrlImagen(@Param("idRecibo") long idRecibo, @Param("urlImagen") String urlImagen); + } diff --git a/src/main/java/sic/service/IReciboService.java b/src/main/java/sic/service/IReciboService.java index 9f9764e38..bf1988010 100644 --- a/src/main/java/sic/service/IReciboService.java +++ b/src/main/java/sic/service/IReciboService.java @@ -10,6 +10,7 @@ import org.springframework.data.domain.Page; import sic.modelo.*; import sic.modelo.criteria.BusquedaReciboCriteria; +import sic.modelo.dto.NuevoReciboDepositoDTO; public interface IReciboService { @@ -38,6 +39,10 @@ List construirRecibos( Recibo construirReciboPorPayment( Sucursal sucursal, Usuario usuario, Cliente cliente, Payment payment); + Recibo guardarReciboPorDeposito(NuevoReciboDepositoDTO nuevoReciboDepositoDTO); + + void aprobarRecibo(long idRecibo); + long getSiguienteNumeroRecibo(long idSucursal, long serie); void eliminar(long idRecibo); @@ -62,4 +67,6 @@ BigDecimal getTotalRecibosProveedoresQueAfectanCajaEntreFechas( BigDecimal getTotalRecibosClientesEntreFechas(long idSucursal, LocalDateTime desde, LocalDateTime hasta); BigDecimal getTotalRecibosProveedoresEntreFechas(long idSucursal, LocalDateTime desde, LocalDateTime hasta); + + String subirImagenRecibo(long idRecibo, byte[] imagen); } diff --git a/src/main/java/sic/service/impl/NotaServiceImpl.java b/src/main/java/sic/service/impl/NotaServiceImpl.java index 0dc94ef84..e714e5336 100644 --- a/src/main/java/sic/service/impl/NotaServiceImpl.java +++ b/src/main/java/sic/service/impl/NotaServiceImpl.java @@ -585,6 +585,11 @@ public void validarReglasDeNegocio(Nota nota) { messageSource.getMessage("mensaje_nota_de_renglones_vacio", null, Locale.getDefault())); } } else { + Recibo recibo = ((NotaDebito) nota).getRecibo(); + if (recibo != null && recibo.getEstado() != EstadoRecibo.APROBADO) + throw new BusinessServiceException( + messageSource.getMessage( + "mensaje_nota_debito_recibo_no_aprobado", null, Locale.getDefault())); if (((NotaDebito) nota).getRenglonesNotaDebito() == null || ((NotaDebito) nota).getRenglonesNotaDebito().isEmpty()) { throw new BusinessServiceException( diff --git a/src/main/java/sic/service/impl/ReciboServiceImpl.java b/src/main/java/sic/service/impl/ReciboServiceImpl.java index 3a75a34e6..f69a43e78 100644 --- a/src/main/java/sic/service/impl/ReciboServiceImpl.java +++ b/src/main/java/sic/service/impl/ReciboServiceImpl.java @@ -25,6 +25,7 @@ import org.springframework.transaction.annotation.Transactional; import sic.modelo.*; import sic.modelo.criteria.BusquedaReciboCriteria; +import sic.modelo.dto.NuevoReciboDepositoDTO; import sic.repository.ReciboRepository; import sic.service.*; import sic.exception.BusinessServiceException; @@ -40,6 +41,8 @@ public class ReciboServiceImpl implements IReciboService { private final INotaService notaService; private final IFormaDePagoService formaDePagoService; private final ICajaService cajaService; + private final IPedidoService pedidoService; + private final IPhotoVideoUploader photoVideoUploader; private final Logger logger = LoggerFactory.getLogger(this.getClass()); private static final int TAMANIO_PAGINA_DEFAULT = 25; private final MessageSource messageSource; @@ -54,6 +57,8 @@ public ReciboServiceImpl( INotaService notaService, IFormaDePagoService formaDePagoService, ICajaService cajaService, + IPedidoService pedidoService, + IPhotoVideoUploader photoVideoUploader, MessageSource messageSource, CustomValidator customValidator) { this.reciboRepository = reciboRepository; @@ -62,6 +67,8 @@ public ReciboServiceImpl( this.notaService = notaService; this.formaDePagoService = formaDePagoService; this.cajaService = cajaService; + this.pedidoService = pedidoService; + this.photoVideoUploader = photoVideoUploader; this.messageSource = messageSource; this.customValidator = customValidator; } @@ -173,7 +180,8 @@ public Recibo guardar(Recibo recibo) { recibo.getSucursal().getConfiguracionSucursal().getNroPuntoDeVentaAfip())); this.validarReglasDeNegocio(recibo); recibo = reciboRepository.save(recibo); - this.cuentaCorrienteService.asentarEnCuentaCorriente(recibo, TipoDeOperacion.ALTA); + if (recibo.getEstado() == EstadoRecibo.APROBADO) + this.cuentaCorrienteService.asentarEnCuentaCorriente(recibo, TipoDeOperacion.ALTA); logger.warn("El Recibo {} se guardó correctamente.", recibo); return recibo; } @@ -269,6 +277,50 @@ public Recibo construirReciboPorPayment( return nuevoRecibo; } + @Transactional + @Override + public Recibo guardarReciboPorDeposito(NuevoReciboDepositoDTO nuevoReciboDepositoDTO) { + if (nuevoReciboDepositoDTO.getImagen() == null) + throw new BusinessServiceException( + messageSource.getMessage("mensaje_recibo_deposito_sin_imagen", null, Locale.getDefault())); + Pedido pedidoRelacionadoAlDeposito = + pedidoService.getPedidoNoEliminadoPorId(nuevoReciboDepositoDTO.getIdPedido()); + Recibo recibo = new Recibo(); + recibo.setSucursal(sucursalService.getSucursalPorId(pedidoRelacionadoAlDeposito.getIdSucursal())); + recibo.setConcepto(nuevoReciboDepositoDTO.getConcepto()); + recibo.setCliente(pedidoRelacionadoAlDeposito.getCliente()); + recibo.setFormaDePago( + formaDePagoService.getFormaDePagoPorNombre(FormaDePagoEnum.TRANSFERENCIA_BANCARIA)); + recibo.setUsuario(pedidoRelacionadoAlDeposito.getUsuario()); + recibo.setFecha(LocalDateTime.now()); + recibo.setEstado(EstadoRecibo.SIN_CHEQUEAR); + recibo.setMonto(nuevoReciboDepositoDTO.getMonto()); + recibo = this.guardar(recibo); + recibo.setUrlImagen( + this.subirImagenRecibo(recibo.getIdRecibo(), nuevoReciboDepositoDTO.getImagen())); + return recibo; + } + + @Override + @Transactional + public void aprobarRecibo(long idRecibo) { + Recibo recibo = this.getReciboNoEliminadoPorId(idRecibo); + if (recibo.getEstado() == EstadoRecibo.APROBADO) + throw new BusinessServiceException(messageSource.getMessage( + "mensaje_recibo_ya_aprobado", null, Locale.getDefault())); + recibo.setEstado(EstadoRecibo.APROBADO); + reciboRepository.save(recibo); + } + + @Override + @Transactional + public String subirImagenRecibo(long idRecibo, byte[] imagen) { + String urlImagen = + photoVideoUploader.subirImagen(Recibo.class.getSimpleName() + idRecibo, imagen); + reciboRepository.actualizarUrlImagen(idRecibo, urlImagen); + return urlImagen; + } + @Override @Transactional public void eliminar(long idRecibo) { @@ -311,9 +363,13 @@ public List getRecibosEntreFechasPorFormaDePago( @Override public byte[] getReporteRecibo(Recibo recibo) { + if (recibo.getEstado() != EstadoRecibo.APROBADO) + throw new BusinessServiceException( + messageSource.getMessage( + "mensaje_recibo_reporte_no_aprobado", null, Locale.getDefault())); if (recibo.getProveedor() != null) { - throw new BusinessServiceException(messageSource.getMessage( - "mensaje_recibo_reporte_proveedor", null, Locale.getDefault())); + throw new BusinessServiceException( + messageSource.getMessage("mensaje_recibo_reporte_proveedor", null, Locale.getDefault())); } Map params = new HashMap<>(); params.put("recibo", recibo); diff --git a/src/main/resources/messages.properties b/src/main/resources/messages.properties index 55ddf12a0..7dea96ad5 100644 --- a/src/main/resources/messages.properties +++ b/src/main/resources/messages.properties @@ -102,6 +102,9 @@ mensaje_recibo_cliente_proveedor_vacio=El recibo debe tener un cliente o un prov mensaje_recibo_cliente_proveedor_simultaneos=El recibo no puede poseer cliente y proveedor simultaneamente mensaje_recibo_reporte_proveedor=El recibo pertenece a una factura de compra. No posee reporte mensaje_recibo_no_existente=El recibo solicitado no existe +mensaje_recibo_ya_aprobado=El recibo ya se encuentra aprobado +mensaje_recibo_reporte_no_aprobado=El recibo debe encontrarse aprobado para emitir el comprobante +mensaje_recibo_deposito_sin_imagen=El recibo debe contener la imagen del comprobante #Sucursal mensaje_sucursal_duplicado_nombre=Ya existe una sucursal con el nombre ingresado @@ -196,6 +199,9 @@ mensaje_nota_recargo_neto_no_valido=El recargo neto de la nota es invalido mensaje_nota_monto_no_gravado_no_valido=El monto no gravado no es coincidente con el pago mensaje_nota_c_x_monto_no_gravado_no_valido=El monto no gravado debe ser igual a cero +#NotaDebito +mensaje_nota_debito_recibo_no_aprobado=El recibo asociado debe encontrarse aprobado + #Proveedor mensaje_proveedor_duplicado_idFiscal=Ya existe un proveedor con el ID fiscal ingresado mensaje_proveedor_duplicado_razonSocial=Ya existe un proveedor con la razon social ingresada diff --git a/src/test/java/sic/integration/AppIntegrationTest.java b/src/test/java/sic/integration/AppIntegrationTest.java index 8d799dcb7..afc195ef6 100644 --- a/src/test/java/sic/integration/AppIntegrationTest.java +++ b/src/test/java/sic/integration/AppIntegrationTest.java @@ -531,9 +531,9 @@ void testEscenarioCompraEscenario1() { new BigDecimal("-554.540000000000000"), restTemplate.getForObject( apiPrefix + "/cuentas-corriente/proveedores/1/saldo", BigDecimal.class)); - Recibo recibo = - Recibo.builder() - .monto(554.54) + NuevoReciboProveedorDTO recibo = + NuevoReciboProveedorDTO.builder() + .monto(new BigDecimal("554.54")) .concepto("Recibo para proveedor") .idSucursal(sucursal.getIdSucursal()) .idProveedor(proveedorRecuperado.getIdProveedor()) @@ -541,7 +541,11 @@ void testEscenarioCompraEscenario1() { .build(); Recibo reciboRecuperado = restTemplate.postForObject(apiPrefix + "/recibos/proveedores", recibo, Recibo.class); - assertEquals(recibo, reciboRecuperado); + assertEquals(recibo.getMonto().doubleValue(), reciboRecuperado.getMonto()); + assertEquals(recibo.getIdFormaDePago(), reciboRecuperado.getIdFormaDePago()); + assertEquals(recibo.getIdSucursal(), reciboRecuperado.getIdSucursal()); + assertEquals(recibo.getIdProveedor(), reciboRecuperado.getIdProveedor()); + assertEquals(recibo.getConcepto(), reciboRecuperado.getConcepto()); assertEquals( 0.0, restTemplate @@ -1212,10 +1216,9 @@ void testEscenarioVenta1() { restTemplate .getForObject(apiPrefix + "/cuentas-corriente/clientes/1/saldo", BigDecimal.class) .doubleValue()); - Recibo recibo = - Recibo.builder() + NuevoReciboClienteDTO recibo = NuevoReciboClienteDTO.builder() .concepto("Recibo Test") - .monto(108320.27151325) + .monto(new BigDecimal("108320.27151325")) .idSucursal(sucursal.getIdSucursal()) .idCliente(cliente.getIdCliente()) .idFormaDePago(1L) @@ -1225,7 +1228,11 @@ void testEscenarioVenta1() { assertNotNull( restTemplate.getForObject( apiPrefix + "/recibos/" + reciboDeFactura.getIdRecibo() + "/reporte", byte[].class)); - assertEquals(recibo, reciboDeFactura); + assertEquals(recibo.getConcepto(), reciboDeFactura.getConcepto()); + assertEquals(recibo.getMonto().doubleValue(), reciboDeFactura.getMonto()); + assertEquals(recibo.getIdSucursal(), reciboDeFactura.getIdSucursal()); + assertEquals(recibo.getIdSucursal(), reciboDeFactura.getIdCliente()); + assertEquals(recibo.getIdFormaDePago(), reciboDeFactura.getIdFormaDePago()); assertEquals( 0.0, restTemplate @@ -1453,10 +1460,10 @@ void testEscenarioRegistracionYPedidoDelNuevoCliente() { assertEquals("theRedWolf", cliente.getNombreFiscal()); assertEquals(0.0, cliente.getMontoCompraMinima().doubleValue()); assertFalse(cliente.isPuedeComprarAPlazo()); - sic.model.CuentaCorrienteCliente cuentaCorrienteCliente = + CuentaCorrienteCliente cuentaCorrienteCliente = restTemplate.getForObject( apiPrefix + "/cuentas-corriente/clientes/" + cliente.getIdCliente(), - sic.model.CuentaCorrienteCliente.class); + CuentaCorrienteCliente.class); assertNotNull(cuentaCorrienteCliente); assertEquals(0.0, cuentaCorrienteCliente.getSaldo().doubleValue()); cliente.setUbicacionFacturacion(Ubicacion.builder().idLocalidad(2L).idProvincia(2L).build()); @@ -1538,8 +1545,58 @@ void testEscenarioRegistracionYPedidoDelNuevoCliente() { } @Test - @DisplayName("Cerrar caja y verificar movimientos") + @DisplayName("Realizar una transferencia para un pedido, luego aprobarlo") @Order(14) + void test() throws IOException { + this.iniciarSesionComoAdministrador(); + Usuario usuario = restTemplate.getForObject(apiPrefix + "/usuarios/4", Usuario.class); + assertEquals("Sansa María", usuario.getNombre()); + assertEquals("Stark", usuario.getApellido()); + assertTrue(usuario.isHabilitado()); + this.token = + restTemplate + .postForEntity( + apiPrefix + "/login", + new Credencial(usuario.getUsername(), "caraDeMala"), + String.class) + .getBody(); + BusquedaPedidoCriteria pedidoCriteria = + BusquedaPedidoCriteria.builder().idSucursal(1L).build(); + HttpEntity requestEntity = new HttpEntity<>(pedidoCriteria); + PaginaRespuestaRest resultadoBusquedaPedido = + restTemplate + .exchange( + apiPrefix + "/pedidos/busqueda/criteria", + HttpMethod.POST, + requestEntity, + new ParameterizedTypeReference>() {}) + .getBody(); + assertNotNull(resultadoBusquedaPedido); + List pedidosRecuperados = resultadoBusquedaPedido.getContent(); + assertEquals(1, pedidosRecuperados.size()); + BufferedImage bImage = ImageIO.read(getClass().getResource("/imagenProductoTest.jpeg")); + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + ImageIO.write(bImage, "jpeg", bos); + NuevoReciboDepositoDTO reciboDepositoDTO = NuevoReciboDepositoDTO.builder() + .concepto("Transferencia Bancaria") + .idPedido(pedidosRecuperados.get(0).getIdPedido()) + .imagen(bos.toByteArray()) + .monto(new BigDecimal("3000")) + .build(); + Recibo reciboCreado = restTemplate.postForObject(apiPrefix + "/recibos/clientes/depositos", reciboDepositoDTO, Recibo.class); + assertEquals(reciboDepositoDTO.getConcepto(), reciboCreado.getConcepto()); + assertEquals(reciboDepositoDTO.getMonto().doubleValue(), reciboCreado.getMonto()); + assertNotNull(reciboCreado.getUrlImagen()); + assertEquals(EstadoRecibo.SIN_CHEQUEAR, reciboCreado.getEstado()); + this.iniciarSesionComoAdministrador(); + restTemplate.put(apiPrefix + "/recibos/" + reciboCreado.getIdRecibo() + "/aprobar",null); + reciboCreado = restTemplate.getForObject(apiPrefix + "/recibos/" + reciboCreado.getIdRecibo(), Recibo.class); + assertEquals(EstadoRecibo.APROBADO, reciboCreado.getEstado()); + } + + @Test + @DisplayName("Cerrar caja y verificar movimientos") + @Order(15) void testEscenarioCerrarCaja1() { this.iniciarSesionComoAdministrador(); List sucursales = @@ -1606,7 +1663,7 @@ void testEscenarioCerrarCaja1() { apiPrefix + "/cajas/" + cajasRecuperadas.get(0).getIdCaja() + "/saldo-afecta-caja", BigDecimal.class)); assertEquals( - new BigDecimal("108265.731513250000000"), + new BigDecimal("111265.731513250000000"), restTemplate.getForObject( apiPrefix + "/cajas/" + cajasRecuperadas.get(0).getIdCaja() + "/saldo-sistema", BigDecimal.class)); @@ -1614,7 +1671,7 @@ void testEscenarioCerrarCaja1() { @Test @DisplayName("Reabrir caja, corregir saldo con un gasto por $750 en efectivo") - @Order(15) + @Order(16) void testEscenarioCerrarCaja2() { this.iniciarSesionComoAdministrador(); List sucursales = @@ -1692,7 +1749,7 @@ void testEscenarioCerrarCaja2() { apiPrefix + "/cajas/" + cajasRecuperadas.get(0).getIdCaja() + "/saldo-afecta-caja", BigDecimal.class)); assertEquals( - new BigDecimal("107615.731513250000000"), + new BigDecimal("110615.731513250000000"), restTemplate.getForObject( apiPrefix + "/cajas/" + cajasRecuperadas.get(0).getIdCaja() + "/saldo-sistema", BigDecimal.class)); @@ -1700,7 +1757,7 @@ void testEscenarioCerrarCaja2() { @Test @DisplayName("Facturar un pedido, luego intentar cancelarlo sin éxito") - @Order(16) + @Order(17) void testEscenarioFacturarPedidoAndIntentarEliminarlo() { this.iniciarSesionComoAdministrador(); BusquedaProductoCriteria productosCriteria = BusquedaProductoCriteria.builder().build(); @@ -1834,7 +1891,7 @@ void testEscenarioFacturarPedidoAndIntentarEliminarlo() { @Test @DisplayName("Actualizar stock de un producto para tener cantidades en dos sucursales") - @Order(17) + @Order(18) void testEscenarioActualizarStockParaDosSucursales() { this.iniciarSesionComoAdministrador(); Cliente clienteParaEditar = restTemplate.getForObject(apiPrefix + "/clientes/2", Cliente.class); @@ -1914,7 +1971,7 @@ void testEscenarioActualizarStockParaDosSucursales() { @Test @DisplayName("Realizar un pedido que requiera del stock de ambas") - @Order(18) + @Order(19) void testEscenarioPedidoConStockDeDosSucursales() { this.iniciarSesionComoAdministrador(); Usuario usuario = restTemplate.getForObject(apiPrefix + "/usuarios/4", Usuario.class); @@ -2004,7 +2061,7 @@ void testEscenarioPedidoConStockDeDosSucursales() { @Test @DisplayName("Facturar el pedido anterior") - @Order(19) + @Order(20) void testEscenarioFacturarPedido() { this.iniciarSesionComoAdministrador(); BusquedaPedidoCriteria pedidoCriteria = @@ -2060,7 +2117,7 @@ void testEscenarioFacturarPedido() { @Test @DisplayName("Verificar stock y cerrar caja") - @Order(20) + @Order(21) void testEscenarioVerificarStockAndCerrarCaja() { this.iniciarSesionComoAdministrador(); BusquedaProductoCriteria productosCriteria = BusquedaProductoCriteria.builder().build(); diff --git a/src/test/java/sic/model/Recibo.java b/src/test/java/sic/model/Recibo.java index 485b8d494..d113318ac 100644 --- a/src/test/java/sic/model/Recibo.java +++ b/src/test/java/sic/model/Recibo.java @@ -1,6 +1,7 @@ package sic.model; import lombok.*; +import sic.modelo.EstadoRecibo; import java.time.LocalDateTime; @@ -40,4 +41,6 @@ public class Recibo { private Long idViajante; private String nombreViajante; private double monto; + private String urlImagen; + private EstadoRecibo estado; } diff --git a/src/test/resources/data.sql b/src/test/resources/data.sql index 6eff61c63..1f11eda4b 100644 --- a/src/test/resources/data.sql +++ b/src/test/resources/data.sql @@ -7,7 +7,7 @@ VALUES ('N3400',50.000000000000000,false,'Corrientes',1), ('H3500',150.000000000000000,false,'Resistencia',3); INSERT INTO formadepago(afecta_caja, eliminada, nombre, predeterminado) -VALUES (true,false,'Efectivo',true), (false, false, 'Cheque de 3ros', false); +VALUES (true,false,'Efectivo',true), (false, false, 'Cheque de 3ros', false), (false, false, 'Transferencia Bancaria', false); INSERT INTO usuario (apellido, eliminado, email, habilitado, id_sucursal_predeterminada, nombre, password, password_recovery_key, password_recovery_key_expiration_date, username) From 87fae8b91d3241cc54d99f780c3a1424978dc93b Mon Sep 17 00:00:00 2001 From: Mayol Jose Date: Fri, 23 Apr 2021 21:00:05 -0300 Subject: [PATCH 02/11] Agrega script --- scripts/issues/issue417.sql | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 scripts/issues/issue417.sql diff --git a/scripts/issues/issue417.sql b/scripts/issues/issue417.sql new file mode 100644 index 000000000..c11536f95 --- /dev/null +++ b/scripts/issues/issue417.sql @@ -0,0 +1,10 @@ +ALTER TABLE recibo +ADD estado varchar(255) AFTER idPagoMercadoPago; + +SET SQL_SAFE_UPDATES = 0; + +update recibo +set recibo.estado = 'APROBADO'; + +SET SQL_SAFE_UPDATES = 1; + From 3ce0f13db6a960ad92c7b7dcbe03a42643dd96ff Mon Sep 17 00:00:00 2001 From: Mayol Jose Date: Mon, 26 Apr 2021 22:38:07 -0300 Subject: [PATCH 03/11] Corrige code smells --- .../java/sic/controller/ReciboController.java | 18 +-- .../java/sic/repository/ReciboRepository.java | 1 - .../sic/service/impl/NotaServiceImpl.java | 116 +++++++++--------- .../sic/service/impl/ReciboServiceImpl.java | 28 ++--- 4 files changed, 76 insertions(+), 87 deletions(-) diff --git a/src/main/java/sic/controller/ReciboController.java b/src/main/java/sic/controller/ReciboController.java index f04dd8ca3..22af9b649 100644 --- a/src/main/java/sic/controller/ReciboController.java +++ b/src/main/java/sic/controller/ReciboController.java @@ -1,7 +1,6 @@ package sic.controller; import io.jsonwebtoken.Claims; -import org.modelmapper.ModelMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.http.HttpHeaders; @@ -17,7 +16,6 @@ import sic.modelo.dto.NuevoReciboClienteDTO; import sic.modelo.dto.NuevoReciboDepositoDTO; import sic.modelo.dto.NuevoReciboProveedorDTO; -import sic.modelo.dto.ReciboDTO; import sic.service.*; import java.math.BigDecimal; import java.time.LocalDateTime; @@ -33,8 +31,6 @@ public class ReciboController { private final IProveedorService proveedorService; private final IFormaDePagoService formaDePagoService; private final IAuthService authService; - private final ModelMapper modelMapper; - @Autowired public ReciboController( IReciboService reciboService, @@ -43,8 +39,7 @@ public ReciboController( IClienteService clienteService, IProveedorService proveedorService, IFormaDePagoService formaDePagoService, - IAuthService authService, - ModelMapper modelMapper) { + IAuthService authService) { this.reciboService = reciboService; this.sucursalService = sucursalService; this.usuarioService = usuarioService; @@ -52,7 +47,6 @@ public ReciboController( this.formaDePagoService = formaDePagoService; this.proveedorService = proveedorService; this.authService = authService; - this.modelMapper = modelMapper; } @GetMapping("/recibos/{idRecibo}") @@ -77,7 +71,7 @@ public BigDecimal getTotalRecibos(@RequestBody BusquedaReciboCriteria criteria) public Recibo guardarReciboCliente( @RequestBody NuevoReciboClienteDTO nuevoReciboClienteDTO, @RequestHeader("Authorization") String authorizationHeader) { - Recibo recibo = new Recibo(); + var recibo = new Recibo(); recibo.setConcepto(nuevoReciboClienteDTO.getConcepto()); recibo.setSucursal(sucursalService.getSucursalPorId(nuevoReciboClienteDTO.getIdSucursal())); recibo.setCliente( @@ -85,7 +79,7 @@ public Recibo guardarReciboCliente( recibo.setFormaDePago( formaDePagoService.getFormasDePagoNoEliminadoPorId( nuevoReciboClienteDTO.getIdFormaDePago())); - Claims claims = authService.getClaimsDelToken(authorizationHeader); + var claims = authService.getClaimsDelToken(authorizationHeader); recibo.setUsuario( usuarioService.getUsuarioNoEliminadoPorId(((Integer) claims.get("idUsuario")).longValue())); recibo.setFecha(LocalDateTime.now()); @@ -99,7 +93,7 @@ public Recibo guardarReciboCliente( public Recibo guardarReciboProveedor( @RequestBody NuevoReciboProveedorDTO nuevoReciboProveedorDTO, @RequestHeader("Authorization") String authorizationHeader) { - Recibo recibo = new Recibo(); + var recibo = new Recibo(); recibo.setConcepto(nuevoReciboProveedorDTO.getConcepto()); recibo.setSucursal(sucursalService.getSucursalPorId(nuevoReciboProveedorDTO.getIdSucursal())); recibo.setProveedor( @@ -107,7 +101,7 @@ public Recibo guardarReciboProveedor( recibo.setFormaDePago( formaDePagoService.getFormasDePagoNoEliminadoPorId( nuevoReciboProveedorDTO.getIdFormaDePago())); - Claims claims = authService.getClaimsDelToken(authorizationHeader); + var claims = authService.getClaimsDelToken(authorizationHeader); recibo.setUsuario( usuarioService.getUsuarioNoEliminadoPorId(((Integer) claims.get("idUsuario")).longValue())); recibo.setFecha(LocalDateTime.now()); @@ -130,7 +124,7 @@ public void eliminar(@PathVariable long idRecibo) { @GetMapping("/recibos/{idRecibo}/reporte") public ResponseEntity getReporteRecibo(@PathVariable long idRecibo) { - HttpHeaders headers = new HttpHeaders(); + var headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_PDF); headers.add("content-disposition", "inline; filename=Recibo.pdf"); headers.setCacheControl("must-revalidate, post-check=0, pre-check=0"); diff --git a/src/main/java/sic/repository/ReciboRepository.java b/src/main/java/sic/repository/ReciboRepository.java index 72b080c53..2256bfa95 100644 --- a/src/main/java/sic/repository/ReciboRepository.java +++ b/src/main/java/sic/repository/ReciboRepository.java @@ -10,7 +10,6 @@ import org.springframework.data.querydsl.QuerydslPredicateExecutor; import org.springframework.data.repository.PagingAndSortingRepository; import org.springframework.data.repository.query.Param; -import sic.modelo.EstadoRecibo; import sic.modelo.Sucursal; import sic.modelo.Recibo; diff --git a/src/main/java/sic/service/impl/NotaServiceImpl.java b/src/main/java/sic/service/impl/NotaServiceImpl.java index e714e5336..2e6b1a1b1 100644 --- a/src/main/java/sic/service/impl/NotaServiceImpl.java +++ b/src/main/java/sic/service/impl/NotaServiceImpl.java @@ -117,7 +117,7 @@ public Nota getNotaNoEliminadaPorId(long idNota) { @Override @Transactional public void eliminarNota(long idNota) { - Nota nota = this.getNotaNoEliminadaPorId(idNota); + var nota = this.getNotaNoEliminadaPorId(idNota); if (nota.getMovimiento() == Movimiento.COMPRA && nota.getFacturaCompra() != null) { throw new BusinessServiceException( messageSource.getMessage( @@ -178,7 +178,7 @@ public Page buscarNotasDebito( private Pageable getPageable(Integer pagina, String ordenarPor, String sentido) { if (pagina == null) pagina = 0; - String ordenDefault = "fecha"; + var ordenDefault = "fecha"; if (ordenarPor == null || sentido == null) { return PageRequest.of(pagina, TAMANIO_PAGINA_DEFAULT, Sort.by(Sort.Direction.DESC, ordenDefault)); } else { @@ -195,8 +195,8 @@ private Pageable getPageable(Integer pagina, String ordenarPor, String sentido) private BooleanBuilder getBuilderNotaCredito( BusquedaNotaCriteria criteria, long idUsuarioLoggedIn) { - QNotaCredito qNotaCredito = QNotaCredito.notaCredito; - BooleanBuilder builder = new BooleanBuilder(); + var qNotaCredito = QNotaCredito.notaCredito; + var builder = new BooleanBuilder(); builder.and( qNotaCredito .sucursal @@ -231,8 +231,8 @@ private BooleanBuilder getBuilderNotaCredito( builder .and(qNotaCredito.serie.eq(criteria.getNumSerie())) .and(qNotaCredito.nroNota.eq(criteria.getNumNota())); - Usuario usuarioLogueado = usuarioService.getUsuarioNoEliminadoPorId(idUsuarioLoggedIn); - BooleanBuilder rsPredicate = new BooleanBuilder(); + var usuarioLogueado = usuarioService.getUsuarioNoEliminadoPorId(idUsuarioLoggedIn); + var rsPredicate = new BooleanBuilder(); if (!usuarioLogueado.getRoles().contains(Rol.ADMINISTRADOR) && !usuarioLogueado.getRoles().contains(Rol.VENDEDOR) && !usuarioLogueado.getRoles().contains(Rol.ENCARGADO)) { @@ -242,7 +242,7 @@ private BooleanBuilder getBuilderNotaCredito( rsPredicate.or(qNotaCredito.cliente.viajante.eq(usuarioLogueado)); break; case COMPRADOR: - Cliente clienteRelacionado = + var clienteRelacionado = clienteService.getClientePorIdUsuario(idUsuarioLoggedIn); if (clienteRelacionado != null) { rsPredicate.or(qNotaCredito.cliente.eq(clienteRelacionado)); @@ -259,8 +259,8 @@ private BooleanBuilder getBuilderNotaCredito( private BooleanBuilder getBuilderNotaDebito( BusquedaNotaCriteria criteria, long idUsuarioLoggedIn) { - QNotaDebito qNotaDebito = QNotaDebito.notaDebito; - BooleanBuilder builder = new BooleanBuilder(); + var qNotaDebito = QNotaDebito.notaDebito; + var builder = new BooleanBuilder(); builder.and( qNotaDebito .sucursal @@ -295,8 +295,8 @@ private BooleanBuilder getBuilderNotaDebito( builder .and(qNotaDebito.serie.eq(criteria.getNumSerie())) .and(qNotaDebito.nroNota.eq(criteria.getNumNota())); - Usuario usuarioLogueado = usuarioService.getUsuarioNoEliminadoPorId(idUsuarioLoggedIn); - BooleanBuilder rsPredicate = new BooleanBuilder(); + var usuarioLogueado = usuarioService.getUsuarioNoEliminadoPorId(idUsuarioLoggedIn); + var rsPredicate = new BooleanBuilder(); if (!usuarioLogueado.getRoles().contains(Rol.ADMINISTRADOR) && !usuarioLogueado.getRoles().contains(Rol.VENDEDOR) && !usuarioLogueado.getRoles().contains(Rol.ENCARGADO)) { @@ -337,8 +337,8 @@ public boolean existsNotaDebitoPorRecibo(Recibo recibo) { @Override public List getTipoNotaCreditoCliente(Long idCliente, Long idSucursal) { List tiposPermitidos = new ArrayList<>(); - Sucursal sucursal = sucursalService.getSucursalPorId(idSucursal); - Cliente cliente = clienteService.getClienteNoEliminadoPorId(idCliente); + var sucursal = sucursalService.getSucursalPorId(idSucursal); + var cliente = clienteService.getClienteNoEliminadoPorId(idCliente); if (CategoriaIVA.discriminaIVA(sucursal.getCategoriaIVA()) && CategoriaIVA.discriminaIVA(cliente.getCategoriaIVA())) { tiposPermitidos.add(TipoDeComprobante.NOTA_CREDITO_A); @@ -356,8 +356,8 @@ public List getTipoNotaCreditoCliente(Long idCliente, Long id @Override public List getTipoNotaDebitoCliente(Long idCliente, Long idSucursal) { List tiposPermitidos = new ArrayList<>(); - Sucursal sucursal = sucursalService.getSucursalPorId(idSucursal); - Cliente cliente = clienteService.getClienteNoEliminadoPorId(idCliente); + var sucursal = sucursalService.getSucursalPorId(idSucursal); + var cliente = clienteService.getClienteNoEliminadoPorId(idCliente); if (CategoriaIVA.discriminaIVA(sucursal.getCategoriaIVA()) && CategoriaIVA.discriminaIVA(cliente.getCategoriaIVA())) { tiposPermitidos.add(TipoDeComprobante.NOTA_DEBITO_A); @@ -375,8 +375,8 @@ public List getTipoNotaDebitoCliente(Long idCliente, Long idS @Override public List getTipoNotaCreditoProveedor(Long idProveedor, Long idSucursal) { List tiposPermitidos = new ArrayList<>(); - Sucursal sucursal = sucursalService.getSucursalPorId(idSucursal); - Proveedor proveedor = proveedorService.getProveedorNoEliminadoPorId(idProveedor); + var sucursal = sucursalService.getSucursalPorId(idSucursal); + var proveedor = proveedorService.getProveedorNoEliminadoPorId(idProveedor); if (CategoriaIVA.discriminaIVA(sucursal.getCategoriaIVA())) { if (CategoriaIVA.discriminaIVA(proveedor.getCategoriaIVA())) { tiposPermitidos.add(TipoDeComprobante.NOTA_CREDITO_A); @@ -398,8 +398,8 @@ public List getTipoNotaCreditoProveedor(Long idProveedor, Lon @Override public List getTipoNotaDebitoProveedor(Long idProveedor, Long idSucursal) { List tiposPermitidos = new ArrayList<>(); - Sucursal sucursal = sucursalService.getSucursalPorId(idSucursal); - Proveedor proveedor = proveedorService.getProveedorNoEliminadoPorId(idProveedor); + var sucursal = sucursalService.getSucursalPorId(idSucursal); + var proveedor = proveedorService.getProveedorNoEliminadoPorId(idProveedor); if (CategoriaIVA.discriminaIVA(sucursal.getCategoriaIVA())) { if (CategoriaIVA.discriminaIVA(proveedor.getCategoriaIVA())) { tiposPermitidos.add(TipoDeComprobante.NOTA_DEBITO_A); @@ -421,7 +421,7 @@ public List getTipoNotaDebitoProveedor(Long idProveedor, Long @Override public List getNotasCreditoPorFactura(Long idFactura) { List notasCredito = new ArrayList<>(); - Factura factura = facturaService.getFacturaNoEliminadaPorId(idFactura); + var factura = facturaService.getFacturaNoEliminadaPorId(idFactura); if (factura instanceof FacturaVenta) { notasCredito = notaCreditoRepository.findAllByFacturaVentaAndEliminada((FacturaVenta) factura, false); @@ -470,7 +470,7 @@ public List getRenglonesFacturaModificadosParaNotaCredito(long i @Override public long getSiguienteNumeroNotaDebitoCliente( Long idSucursal, TipoDeComprobante tipoDeComprobante) { - Sucursal sucursal = sucursalService.getSucursalPorId(idSucursal); + var sucursal = sucursalService.getSucursalPorId(idSucursal); Long numeroNota = notaDebitoRepository.buscarMayorNumNotaDebitoClienteSegunTipo( tipoDeComprobante, @@ -482,7 +482,7 @@ public long getSiguienteNumeroNotaDebitoCliente( @Override public long getSiguienteNumeroNotaCreditoCliente( Long idSucursal, TipoDeComprobante tipoDeComprobante) { - Sucursal sucursal = sucursalService.getSucursalPorId(idSucursal); + var sucursal = sucursalService.getSucursalPorId(idSucursal); Long numeroNota = notaCreditoRepository.buscarMayorNumNotaCreditoClienteSegunTipo( tipoDeComprobante, @@ -585,7 +585,7 @@ public void validarReglasDeNegocio(Nota nota) { messageSource.getMessage("mensaje_nota_de_renglones_vacio", null, Locale.getDefault())); } } else { - Recibo recibo = ((NotaDebito) nota).getRecibo(); + var recibo = ((NotaDebito) nota).getRecibo(); if (recibo != null && recibo.getEstado() != EstadoRecibo.APROBADO) throw new BusinessServiceException( messageSource.getMessage( @@ -603,8 +603,8 @@ public void validarCalculosCredito(NotaCredito notaCredito) { List renglonesNotaCredito = notaCredito.getRenglonesNotaCredito(); BigDecimal subTotal = BigDecimal.ZERO; BigDecimal[] importes = new BigDecimal[renglonesNotaCredito.size()]; - int i = 0; - int sizeRenglonesCredito = renglonesNotaCredito.size(); + var i = 0; + var sizeRenglonesCredito = renglonesNotaCredito.size(); // IVA - importe BigDecimal iva21 = BigDecimal.ZERO; BigDecimal iva105 = BigDecimal.ZERO; @@ -824,8 +824,8 @@ public NotaCredito guardarNotaCredito(NotaCredito notaCredito) { @Override public NotaCredito calcularNotaCreditoConFactura( NuevaNotaCreditoDeFacturaDTO nuevaNotaCreditoDeFacturaDTO, Usuario usuario) { - NotaCredito notaCreditoNueva = new NotaCredito(); - Factura factura = + var notaCreditoNueva = new NotaCredito(); + var factura = facturaService.getFacturaNoEliminadaPorId(nuevaNotaCreditoDeFacturaDTO.getIdFactura()); if (Arrays.asList(nuevaNotaCreditoDeFacturaDTO.getCantidades()).contains(null) || Arrays.asList(nuevaNotaCreditoDeFacturaDTO.getIdsRenglonesFactura()).contains(null)) { @@ -916,7 +916,7 @@ public NotaCredito calcularNotaCreditoConFactura( @Override public NotaCredito calcularNotaCreditoSinFactura( NuevaNotaCreditoSinFacturaDTO nuevaNotaCreditoSinFacturaDTO, Usuario usuario) { - NotaCredito notaCreditoNueva = new NotaCredito(); + var notaCreditoNueva = new NotaCredito(); if (nuevaNotaCreditoSinFacturaDTO.getDetalle() == null || nuevaNotaCreditoSinFacturaDTO.getDetalle().isEmpty()) { throw new BusinessServiceException( @@ -986,9 +986,9 @@ public NotaCredito calcularNotaCreditoSinFactura( @Override public NotaDebito calcularNotaDebitoConRecibo( NuevaNotaDebitoDeReciboDTO nuevaNotaDebitoDeReciboDTO, Usuario usuario) { - NotaDebito notaDebitoCalculada = new NotaDebito(); + var notaDebitoCalculada = new NotaDebito(); notaDebitoCalculada.setFecha(LocalDateTime.now()); - Recibo reciboRelacionado = + var reciboRelacionado = reciboService.getReciboNoEliminadoPorId(nuevaNotaDebitoDeReciboDTO.getIdRecibo()); if (reciboRelacionado.getCliente() != null) { notaDebitoCalculada.setCliente(reciboRelacionado.getCliente()); @@ -1058,12 +1058,12 @@ public NotaDebito calcularNotaDebitoConRecibo( @Override public NotaDebito calcularNotaDebitoSinRecibo( NuevaNotaDebitoSinReciboDTO nuevaNotaDebitoSinReciboDTO, Usuario usuario) { - NotaDebito notaDebitoCalculada = new NotaDebito(); + var notaDebitoCalculada = new NotaDebito(); notaDebitoCalculada.setFecha(LocalDateTime.now()); notaDebitoCalculada.setSucursal(sucursalService.getSucursalPorId(nuevaNotaDebitoSinReciboDTO.getIdSucursal())); if (nuevaNotaDebitoSinReciboDTO.getTipoDeComprobante() != null) { if (nuevaNotaDebitoSinReciboDTO.getIdCliente() != null) { - Cliente cliente = + var cliente = clienteService.getClienteNoEliminadoPorId(nuevaNotaDebitoSinReciboDTO.getIdCliente()); notaDebitoCalculada.setCliente(cliente); notaDebitoCalculada.setMovimiento(Movimiento.VENTA); @@ -1074,7 +1074,7 @@ public NotaDebito calcularNotaDebitoSinRecibo( messageSource.getMessage("mensaje_nota_tipo_no_valido", null, Locale.getDefault())); } } else if (nuevaNotaDebitoSinReciboDTO.getIdProveedor() != null) { - Proveedor proveedor = + var proveedor = proveedorService.getProveedorNoEliminadoPorId( nuevaNotaDebitoSinReciboDTO.getIdProveedor()); notaDebitoCalculada.setProveedor(proveedor); @@ -1247,7 +1247,7 @@ public byte[] getReporteNota(Nota nota) { ds = new JRBeanCollectionDataSource(renglones); params.put("notaDebito", nota); } - ConfiguracionSucursal configuracionSucursal = nota.getSucursal().getConfiguracionSucursal(); + var configuracionSucursal = nota.getSucursal().getConfiguracionSucursal(); params.put("preImpresa", configuracionSucursal.isUsarFacturaVentaPreImpresa()); if (nota.getTipoComprobante().equals(TipoDeComprobante.NOTA_CREDITO_B) || nota.getTipoComprobante().equals(TipoDeComprobante.NOTA_CREDITO_C) @@ -1313,8 +1313,8 @@ public List calcularRenglonesCreditoProducto( List renglonesNota = new ArrayList<>(); RenglonNotaCredito renglonNota; if (cantidad.length == idRenglonFactura.length) { - for (int i = 0; i < idRenglonFactura.length; i++) { - RenglonFactura renglonFactura = facturaService.getRenglonFactura(idRenglonFactura[i]); + for (var i = 0; i < idRenglonFactura.length; i++) { + var renglonFactura = facturaService.getRenglonFactura(idRenglonFactura[i]); if (renglonFactura.getCantidad().compareTo(cantidad[i]) < 0 || cantidad[i].compareTo(BigDecimal.ZERO) < 0) { throw new BusinessServiceException( @@ -1379,7 +1379,7 @@ public List calcularRenglonesCreditoProducto( public RenglonNotaCredito calcularRenglonCredito( TipoDeComprobante tipo, String detalle, BigDecimal monto) { this.validarTipoNotaCredito(tipo); - RenglonNotaCredito renglonNota = new RenglonNotaCredito(); + var renglonNota = new RenglonNotaCredito(); renglonNota.setIdProductoItem(null); renglonNota.setCodigoItem(null); renglonNota.setDescripcionItem(detalle); @@ -1452,7 +1452,7 @@ private void validarTipoNotaCredito(TipoDeComprobante tipo) { @Override public RenglonNotaDebito calcularRenglonDebitoConRecibo(Recibo recibo) { - RenglonNotaDebito renglonNota = new RenglonNotaDebito(); + var renglonNota = new RenglonNotaDebito(); String descripcion = "Nº Recibo " + recibo.getNumSerie() + "-" + recibo.getNumRecibo() + ": " + recibo.getConcepto(); renglonNota.setDescripcion(descripcion); @@ -1467,35 +1467,31 @@ public RenglonNotaDebito calcularRenglonDebitoConRecibo(Recibo recibo) { @Override public RenglonNotaDebito calcularRenglonDebito( BigDecimal monto, TipoDeComprobante tipoDeComprobante) { - RenglonNotaDebito renglonNota = new RenglonNotaDebito(); + var renglonNota = new RenglonNotaDebito(); renglonNota.setDescripcion("Gasto Administrativo"); switch (tipoDeComprobante) { - case NOTA_DEBITO_A: - case NOTA_DEBITO_B: - case NOTA_DEBITO_PRESUPUESTO: + case NOTA_DEBITO_A, NOTA_DEBITO_B, NOTA_DEBITO_PRESUPUESTO -> { renglonNota.setMonto( - monto.multiply(CIEN).divide(new BigDecimal("121"), 15, RoundingMode.HALF_UP)); + monto.multiply(CIEN).divide(new BigDecimal("121"), 15, RoundingMode.HALF_UP)); renglonNota.setIvaPorcentaje(IVA_21); renglonNota.setIvaNeto( - renglonNota.getMonto().multiply(IVA_21.divide(CIEN, 15, RoundingMode.HALF_UP))); - break; - case NOTA_DEBITO_C: - case NOTA_DEBITO_X: + renglonNota.getMonto().multiply(IVA_21.divide(CIEN, 15, RoundingMode.HALF_UP))); + } + case NOTA_DEBITO_C, NOTA_DEBITO_X -> { renglonNota.setMonto(monto); renglonNota.setIvaPorcentaje(BigDecimal.ZERO); renglonNota.setIvaNeto(BigDecimal.ZERO); - break; - case NOTA_DEBITO_Y: + } + case NOTA_DEBITO_Y -> { renglonNota.setMonto( - monto.multiply(CIEN).divide(new BigDecimal("110.5"), 15, RoundingMode.HALF_UP)); + monto.multiply(CIEN).divide(new BigDecimal("110.5"), 15, RoundingMode.HALF_UP)); renglonNota.setIvaPorcentaje(IVA_105); renglonNota.setIvaNeto( - renglonNota.getMonto().multiply(IVA_105.divide(CIEN, 15, RoundingMode.HALF_UP))); - break; - default: - throw new BusinessServiceException( - messageSource.getMessage( - "mensaje_tipo_de_comprobante_no_valido", null, Locale.getDefault())); + renglonNota.getMonto().multiply(IVA_105.divide(CIEN, 15, RoundingMode.HALF_UP))); + } + default -> throw new BusinessServiceException( + messageSource.getMessage( + "mensaje_tipo_de_comprobante_no_valido", null, Locale.getDefault())); } renglonNota.setImporteBruto(renglonNota.getMonto()); renglonNota.setImporteNeto(renglonNota.getIvaNeto().add(renglonNota.getImporteBruto())); @@ -1638,8 +1634,8 @@ public BigDecimal calcularTotalIVADebito(BusquedaNotaCriteria criteria, long idU @Override public boolean existeNotaCreditoAnteriorSinAutorizar(ComprobanteAFIP comprobante) { - QNotaCredito qNotaCredito = QNotaCredito.notaCredito; - BooleanBuilder builder = new BooleanBuilder(); + var qNotaCredito = QNotaCredito.notaCredito; + var builder = new BooleanBuilder(); builder.and( qNotaCredito .idNota @@ -1656,8 +1652,8 @@ public boolean existeNotaCreditoAnteriorSinAutorizar(ComprobanteAFIP comprobante @Override public boolean existeNotaDebitoAnteriorSinAutorizar(ComprobanteAFIP comprobante) { - QNotaDebito qNotaDebito = QNotaDebito.notaDebito; - BooleanBuilder builder = new BooleanBuilder(); + var qNotaDebito = QNotaDebito.notaDebito; + var builder = new BooleanBuilder(); builder.and( qNotaDebito .idNota diff --git a/src/main/java/sic/service/impl/ReciboServiceImpl.java b/src/main/java/sic/service/impl/ReciboServiceImpl.java index f69a43e78..5b448cf3f 100644 --- a/src/main/java/sic/service/impl/ReciboServiceImpl.java +++ b/src/main/java/sic/service/impl/ReciboServiceImpl.java @@ -91,8 +91,8 @@ public Optional getReciboPorIdMercadoPago(String idPagoMercadoPago) { @Override public BooleanBuilder getBuilder(BusquedaReciboCriteria criteria) { - QRecibo qRecibo = QRecibo.recibo; - BooleanBuilder builder = new BooleanBuilder(); + var qRecibo = QRecibo.recibo; + var builder = new BooleanBuilder(); if (criteria.getConcepto() != null) { String[] terminos = criteria.getConcepto().split(" "); BooleanBuilder rsPredicate = new BooleanBuilder(); @@ -145,7 +145,7 @@ public Page buscarRecibos(BusquedaReciboCriteria criteria) { private Pageable getPageable(Integer pagina, String ordenarPor, String sentido) { if (pagina == null) pagina = 0; - String ordenDefault = "fecha"; + var ordenDefault = "fecha"; if (ordenarPor == null || sentido == null) { return PageRequest.of( pagina, TAMANIO_PAGINA_DEFAULT, Sort.by(Sort.Direction.DESC, ordenDefault)); @@ -210,7 +210,7 @@ public void validarReglasDeNegocio(Recibo recibo) { @Override public long getSiguienteNumeroRecibo(long idSucursal, long serie) { - Recibo recibo = + var recibo = reciboRepository.findTopBySucursalAndNumSerieOrderByNumReciboDesc( sucursalService.getSucursalPorId(idSucursal), serie); if (recibo == null) { @@ -231,7 +231,7 @@ public List construirRecibos( List recibos = new ArrayList<>(); if (idsFormaDePago != null && montos != null && idsFormaDePago.length == montos.length) { HashMap mapIdsFormaDePago = new HashMap<>(); - for (int i = 0; i < idsFormaDePago.length; i++) { + for (var i = 0; i < idsFormaDePago.length; i++) { if (mapIdsFormaDePago.containsKey(idsFormaDePago[i])) { mapIdsFormaDePago.put( idsFormaDePago[i], mapIdsFormaDePago.get(idsFormaDePago[i]).add(montos[i])); @@ -241,13 +241,13 @@ public List construirRecibos( } mapIdsFormaDePago.forEach( (k, v) -> { - Recibo recibo = new Recibo(); + var recibo = new Recibo(); recibo.setCliente(cliente); recibo.setUsuario(usuario); - Sucursal sucursal = sucursalService.getSucursalPorId(idSucursal); + var sucursal = sucursalService.getSucursalPorId(idSucursal); recibo.setSucursal(sucursal); recibo.setFecha(fecha); - FormaDePago fdp = formaDePagoService.getFormasDePagoNoEliminadoPorId(k); + var fdp = formaDePagoService.getFormasDePagoNoEliminadoPorId(k); recibo.setFormaDePago(fdp); recibo.setMonto(v); recibo.setNumSerie( @@ -264,7 +264,7 @@ public List construirRecibos( @Override public Recibo construirReciboPorPayment( Sucursal sucursal, Usuario usuario, Cliente cliente, Payment payment) { - Recibo nuevoRecibo = new Recibo(); + var nuevoRecibo = new Recibo(); nuevoRecibo.setSucursal(sucursal); nuevoRecibo.setFormaDePago( formaDePagoService.getFormaDePagoPorNombre(FormaDePagoEnum.MERCADO_PAGO)); @@ -283,9 +283,9 @@ public Recibo guardarReciboPorDeposito(NuevoReciboDepositoDTO nuevoReciboDeposit if (nuevoReciboDepositoDTO.getImagen() == null) throw new BusinessServiceException( messageSource.getMessage("mensaje_recibo_deposito_sin_imagen", null, Locale.getDefault())); - Pedido pedidoRelacionadoAlDeposito = + var pedidoRelacionadoAlDeposito = pedidoService.getPedidoNoEliminadoPorId(nuevoReciboDepositoDTO.getIdPedido()); - Recibo recibo = new Recibo(); + var recibo = new Recibo(); recibo.setSucursal(sucursalService.getSucursalPorId(pedidoRelacionadoAlDeposito.getIdSucursal())); recibo.setConcepto(nuevoReciboDepositoDTO.getConcepto()); recibo.setCliente(pedidoRelacionadoAlDeposito.getCliente()); @@ -304,7 +304,7 @@ public Recibo guardarReciboPorDeposito(NuevoReciboDepositoDTO nuevoReciboDeposit @Override @Transactional public void aprobarRecibo(long idRecibo) { - Recibo recibo = this.getReciboNoEliminadoPorId(idRecibo); + var recibo = this.getReciboNoEliminadoPorId(idRecibo); if (recibo.getEstado() == EstadoRecibo.APROBADO) throw new BusinessServiceException(messageSource.getMessage( "mensaje_recibo_ya_aprobado", null, Locale.getDefault())); @@ -324,7 +324,7 @@ public String subirImagenRecibo(long idRecibo, byte[] imagen) { @Override @Transactional public void eliminar(long idRecibo) { - Recibo r = this.getReciboNoEliminadoPorId(idRecibo); + var r = this.getReciboNoEliminadoPorId(idRecibo); if (!notaService.existsNotaDebitoPorRecibo(r)) { r.setEliminado(true); this.cuentaCorrienteService.asentarEnCuentaCorriente(r, TipoDeOperacion.ELIMINACION); @@ -338,7 +338,7 @@ public void eliminar(long idRecibo) { } private void actualizarCajaPorEliminacionDeRecibo(Recibo recibo) { - Caja caja = + var caja = this.cajaService.encontrarCajaCerradaQueContengaFechaEntreFechaAperturaYFechaCierre( recibo.getSucursal().getIdSucursal(), recibo.getFecha()); BigDecimal monto = BigDecimal.ZERO; From bfc99a2c2eaea3ba83e19067331d10728dde1caa Mon Sep 17 00:00:00 2001 From: Mayol Jose Date: Tue, 4 May 2021 18:25:03 -0300 Subject: [PATCH 04/11] =?UTF-8?q?Modifica=20el=20script.=20Agrega=20modifi?= =?UTF-8?q?caciones=20en=20el=20alta=20de=20recibos=20por=20dep=C3=B3sito?= =?UTF-8?q?=20para=20considerar=20el=20dep=C3=B3sito=20sin=20pedido=20rela?= =?UTF-8?q?cionado.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/issues/issue417.sql | 5 +++- .../java/sic/controller/ReciboController.java | 8 ++++-- .../modelo/dto/NuevoReciboDepositoDTO.java | 3 ++- .../java/sic/repository/ReciboRepository.java | 3 ++- src/main/java/sic/service/IReciboService.java | 2 +- .../service/impl/FacturaVentaServiceImpl.java | 12 ++++----- .../sic/service/impl/ReciboServiceImpl.java | 26 ++++++++++++++----- .../sic/integration/AppIntegrationTest.java | 14 ++++++++-- 8 files changed, 53 insertions(+), 20 deletions(-) diff --git a/scripts/issues/issue417.sql b/scripts/issues/issue417.sql index c11536f95..0555bdf2e 100644 --- a/scripts/issues/issue417.sql +++ b/scripts/issues/issue417.sql @@ -1,5 +1,8 @@ ALTER TABLE recibo -ADD estado varchar(255) AFTER idPagoMercadoPago; +ADD estado varchar(255) AFTER idPagoMercadoPago; + +ALTER TABLE recibo +ADD urlImagen varchar(255) AFTER estado; SET SQL_SAFE_UPDATES = 0; diff --git a/src/main/java/sic/controller/ReciboController.java b/src/main/java/sic/controller/ReciboController.java index 22af9b649..e1544e38b 100644 --- a/src/main/java/sic/controller/ReciboController.java +++ b/src/main/java/sic/controller/ReciboController.java @@ -112,8 +112,12 @@ public Recibo guardarReciboProveedor( @PostMapping("/recibos/clientes/depositos") @AccesoRolesPermitidos({Rol.COMPRADOR}) - public Recibo guardarReciboPorDeposito(@RequestBody NuevoReciboDepositoDTO nuevoReciboDepositoDTO) { - return reciboService.guardarReciboPorDeposito(nuevoReciboDepositoDTO); + public Recibo guardarReciboPorDeposito( + @RequestBody NuevoReciboDepositoDTO nuevoReciboDepositoDTO, + @RequestHeader("Authorization") String authorizationHeader) { + return reciboService.guardarReciboPorDeposito( + nuevoReciboDepositoDTO, + (Integer) authService.getClaimsDelToken(authorizationHeader).get("idUsuario")); } @DeleteMapping("/recibos/{idRecibo}") diff --git a/src/main/java/sic/modelo/dto/NuevoReciboDepositoDTO.java b/src/main/java/sic/modelo/dto/NuevoReciboDepositoDTO.java index e62db33a9..6730acfc1 100644 --- a/src/main/java/sic/modelo/dto/NuevoReciboDepositoDTO.java +++ b/src/main/java/sic/modelo/dto/NuevoReciboDepositoDTO.java @@ -13,7 +13,8 @@ @Builder public class NuevoReciboDepositoDTO { - private long idPedido; + private Long idPedido; + private Long idSucursal; private String concepto; private byte[] imagen; private BigDecimal monto; diff --git a/src/main/java/sic/repository/ReciboRepository.java b/src/main/java/sic/repository/ReciboRepository.java index 2256bfa95..b9e2213c1 100644 --- a/src/main/java/sic/repository/ReciboRepository.java +++ b/src/main/java/sic/repository/ReciboRepository.java @@ -27,7 +27,8 @@ Optional findReciboByIdPagoMercadoPagoAndEliminado( "SELECT r FROM Recibo r " + "WHERE r.sucursal.idSucursal = :idSucursal " + "AND r.formaDePago.idFormaDePago = :idFormaDePago " - + "AND r.fecha BETWEEN :desde AND :hasta AND r.eliminado = false") + + "AND r.fecha BETWEEN :desde AND :hasta AND r.eliminado = false " + + "AND r.estado = sic.modelo.EstadoRecibo.APROBADO") List getRecibosEntreFechasPorFormaDePago( @Param("idSucursal") long idSucursal, @Param("idFormaDePago") long idFormaDePago, diff --git a/src/main/java/sic/service/IReciboService.java b/src/main/java/sic/service/IReciboService.java index bf1988010..e2611802c 100644 --- a/src/main/java/sic/service/IReciboService.java +++ b/src/main/java/sic/service/IReciboService.java @@ -39,7 +39,7 @@ List construirRecibos( Recibo construirReciboPorPayment( Sucursal sucursal, Usuario usuario, Cliente cliente, Payment payment); - Recibo guardarReciboPorDeposito(NuevoReciboDepositoDTO nuevoReciboDepositoDTO); + Recibo guardarReciboPorDeposito(NuevoReciboDepositoDTO nuevoReciboDepositoDTO, long idUsuario); void aprobarRecibo(long idRecibo); diff --git a/src/main/java/sic/service/impl/FacturaVentaServiceImpl.java b/src/main/java/sic/service/impl/FacturaVentaServiceImpl.java index 4bc882597..5342bd6c8 100644 --- a/src/main/java/sic/service/impl/FacturaVentaServiceImpl.java +++ b/src/main/java/sic/service/impl/FacturaVentaServiceImpl.java @@ -340,12 +340,12 @@ public List guardar( } } } - List tiposAutorizables = - Arrays.asList( - TipoDeComprobante.FACTURA_A, TipoDeComprobante.FACTURA_B, TipoDeComprobante.FACTURA_C); - facturasProcesadas.stream() - .filter(facturaVenta -> tiposAutorizables.contains(facturaVenta.getTipoComprobante())) - .forEach(this::autorizarFacturaVenta); +// List tiposAutorizables = +// Arrays.asList( +// TipoDeComprobante.FACTURA_A, TipoDeComprobante.FACTURA_B, TipoDeComprobante.FACTURA_C); +// facturasProcesadas.stream() +// .filter(facturaVenta -> tiposAutorizables.contains(facturaVenta.getTipoComprobante())) +// .forEach(this::autorizarFacturaVenta); return facturasProcesadas; } diff --git a/src/main/java/sic/service/impl/ReciboServiceImpl.java b/src/main/java/sic/service/impl/ReciboServiceImpl.java index 5b448cf3f..beb1aa018 100644 --- a/src/main/java/sic/service/impl/ReciboServiceImpl.java +++ b/src/main/java/sic/service/impl/ReciboServiceImpl.java @@ -42,6 +42,8 @@ public class ReciboServiceImpl implements IReciboService { private final IFormaDePagoService formaDePagoService; private final ICajaService cajaService; private final IPedidoService pedidoService; + private final IClienteService clienteService; + private final IUsuarioService usuarioService; private final IPhotoVideoUploader photoVideoUploader; private final Logger logger = LoggerFactory.getLogger(this.getClass()); private static final int TAMANIO_PAGINA_DEFAULT = 25; @@ -58,6 +60,8 @@ public ReciboServiceImpl( IFormaDePagoService formaDePagoService, ICajaService cajaService, IPedidoService pedidoService, + IClienteService clienteService, + IUsuarioService usuarioService, IPhotoVideoUploader photoVideoUploader, MessageSource messageSource, CustomValidator customValidator) { @@ -68,6 +72,8 @@ public ReciboServiceImpl( this.formaDePagoService = formaDePagoService; this.cajaService = cajaService; this.pedidoService = pedidoService; + this.clienteService = clienteService; + this.usuarioService = usuarioService; this.photoVideoUploader = photoVideoUploader; this.messageSource = messageSource; this.customValidator = customValidator; @@ -279,19 +285,25 @@ public Recibo construirReciboPorPayment( @Transactional @Override - public Recibo guardarReciboPorDeposito(NuevoReciboDepositoDTO nuevoReciboDepositoDTO) { + public Recibo guardarReciboPorDeposito(NuevoReciboDepositoDTO nuevoReciboDepositoDTO, long idUsuario) { if (nuevoReciboDepositoDTO.getImagen() == null) throw new BusinessServiceException( messageSource.getMessage("mensaje_recibo_deposito_sin_imagen", null, Locale.getDefault())); - var pedidoRelacionadoAlDeposito = - pedidoService.getPedidoNoEliminadoPorId(nuevoReciboDepositoDTO.getIdPedido()); var recibo = new Recibo(); - recibo.setSucursal(sucursalService.getSucursalPorId(pedidoRelacionadoAlDeposito.getIdSucursal())); + if (nuevoReciboDepositoDTO.getIdPedido() != null && nuevoReciboDepositoDTO.getIdPedido() != 0L) { + var pedidoRelacionadoAlDeposito = + pedidoService.getPedidoNoEliminadoPorId(nuevoReciboDepositoDTO.getIdPedido()); + recibo.setSucursal(sucursalService.getSucursalPorId(pedidoRelacionadoAlDeposito.getIdSucursal())); + recibo.setCliente(pedidoRelacionadoAlDeposito.getCliente()); + recibo.setUsuario(pedidoRelacionadoAlDeposito.getUsuario()); + } else { + recibo.setSucursal(sucursalService.getSucursalPorId(nuevoReciboDepositoDTO.getIdSucursal())); + recibo.setCliente(clienteService.getClientePorIdUsuario(idUsuario)); + recibo.setUsuario(usuarioService.getUsuarioNoEliminadoPorId(idUsuario)); + } recibo.setConcepto(nuevoReciboDepositoDTO.getConcepto()); - recibo.setCliente(pedidoRelacionadoAlDeposito.getCliente()); recibo.setFormaDePago( formaDePagoService.getFormaDePagoPorNombre(FormaDePagoEnum.TRANSFERENCIA_BANCARIA)); - recibo.setUsuario(pedidoRelacionadoAlDeposito.getUsuario()); recibo.setFecha(LocalDateTime.now()); recibo.setEstado(EstadoRecibo.SIN_CHEQUEAR); recibo.setMonto(nuevoReciboDepositoDTO.getMonto()); @@ -309,6 +321,8 @@ public void aprobarRecibo(long idRecibo) { throw new BusinessServiceException(messageSource.getMessage( "mensaje_recibo_ya_aprobado", null, Locale.getDefault())); recibo.setEstado(EstadoRecibo.APROBADO); + this.cuentaCorrienteService.asentarEnCuentaCorriente(recibo, TipoDeOperacion.ALTA); + logger.warn("El Recibo {} se aprobó correctamente.", recibo); reciboRepository.save(recibo); } diff --git a/src/test/java/sic/integration/AppIntegrationTest.java b/src/test/java/sic/integration/AppIntegrationTest.java index afc195ef6..9c0d5ca50 100644 --- a/src/test/java/sic/integration/AppIntegrationTest.java +++ b/src/test/java/sic/integration/AppIntegrationTest.java @@ -1139,7 +1139,7 @@ void testEscenarioVenta1() { assertEquals(2, facturas.length); assertEquals(TipoDeComprobante.FACTURA_A, facturas[1].getTipoComprobante()); assertEquals(TipoDeComprobante.FACTURA_X, facturas[0].getTipoComprobante()); - assertNotEquals(0L, facturas[1].getCae()); + //assertNotEquals(0L, facturas[1].getCae()); assertNotNull( restTemplate.getForObject( apiPrefix + "/facturas/ventas/" + facturas[0].getIdFactura() + "/reporte", @@ -1547,7 +1547,7 @@ void testEscenarioRegistracionYPedidoDelNuevoCliente() { @Test @DisplayName("Realizar una transferencia para un pedido, luego aprobarlo") @Order(14) - void test() throws IOException { + void testEscenarioTransferencia() throws IOException { this.iniciarSesionComoAdministrador(); Usuario usuario = restTemplate.getForObject(apiPrefix + "/usuarios/4", Usuario.class); assertEquals("Sansa María", usuario.getNombre()); @@ -1589,9 +1589,19 @@ void test() throws IOException { assertNotNull(reciboCreado.getUrlImagen()); assertEquals(EstadoRecibo.SIN_CHEQUEAR, reciboCreado.getEstado()); this.iniciarSesionComoAdministrador(); + assertEquals( + 0.0, + restTemplate + .getForObject(apiPrefix + "/cuentas-corriente/clientes/2/saldo", BigDecimal.class) + .doubleValue()); restTemplate.put(apiPrefix + "/recibos/" + reciboCreado.getIdRecibo() + "/aprobar",null); reciboCreado = restTemplate.getForObject(apiPrefix + "/recibos/" + reciboCreado.getIdRecibo(), Recibo.class); assertEquals(EstadoRecibo.APROBADO, reciboCreado.getEstado()); + assertEquals( + 3000.00, + restTemplate + .getForObject(apiPrefix + "/cuentas-corriente/clientes/2/saldo", BigDecimal.class) + .doubleValue()); } @Test From 7a6318483a1d1eeb50795f5af996bd08d29b47c3 Mon Sep 17 00:00:00 2001 From: Mayol Jose Date: Fri, 7 May 2021 00:16:45 -0300 Subject: [PATCH 05/11] =?UTF-8?q?Modifica=20la=20emisi=C3=B3n=20del=20repo?= =?UTF-8?q?rte=20de=20recibo=20para=20incluir=20el=20comprobante=20asociad?= =?UTF-8?q?o=20de=20tener=20uno?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/sic/controller/ReciboController.java | 1 - src/main/java/sic/modelo/Recibo.java | 1 + .../service/impl/FacturaVentaServiceImpl.java | 12 +- .../sic/service/impl/ReciboServiceImpl.java | 60 +++-- .../resources/ValidationMessages.properties | 1 + src/main/resources/messages.properties | 1 - .../vista/reportes/ComprobanteRecibo.jasper | Bin 0 -> 31034 bytes .../vista/reportes/ComprobanteRecibo.jrxml | 223 ++++++++++++++++++ .../sic/vista/reportes/Recibo.jasper | Bin 36236 -> 35559 bytes .../resources/sic/vista/reportes/Recibo.jrxml | 10 +- .../sic/integration/AppIntegrationTest.java | 2 +- .../service/impl/ReciboServiceImplTest.java | 7 + 12 files changed, 284 insertions(+), 34 deletions(-) create mode 100644 src/main/resources/sic/vista/reportes/ComprobanteRecibo.jasper create mode 100644 src/main/resources/sic/vista/reportes/ComprobanteRecibo.jrxml diff --git a/src/main/java/sic/controller/ReciboController.java b/src/main/java/sic/controller/ReciboController.java index e1544e38b..6ed642929 100644 --- a/src/main/java/sic/controller/ReciboController.java +++ b/src/main/java/sic/controller/ReciboController.java @@ -1,6 +1,5 @@ package sic.controller; -import io.jsonwebtoken.Claims; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.http.HttpHeaders; diff --git a/src/main/java/sic/modelo/Recibo.java b/src/main/java/sic/modelo/Recibo.java index 33e4efe58..4037d7299 100644 --- a/src/main/java/sic/modelo/Recibo.java +++ b/src/main/java/sic/modelo/Recibo.java @@ -73,6 +73,7 @@ public class Recibo implements Serializable { @Column(precision = 25, scale = 15) @Positive(message = "{mensaje_recibo_monto_igual_menor_cero}") + @NotNull(message = "{mensaje_recibo_sin_monto}") private BigDecimal monto; @Pattern( diff --git a/src/main/java/sic/service/impl/FacturaVentaServiceImpl.java b/src/main/java/sic/service/impl/FacturaVentaServiceImpl.java index 5342bd6c8..4bc882597 100644 --- a/src/main/java/sic/service/impl/FacturaVentaServiceImpl.java +++ b/src/main/java/sic/service/impl/FacturaVentaServiceImpl.java @@ -340,12 +340,12 @@ public List guardar( } } } -// List tiposAutorizables = -// Arrays.asList( -// TipoDeComprobante.FACTURA_A, TipoDeComprobante.FACTURA_B, TipoDeComprobante.FACTURA_C); -// facturasProcesadas.stream() -// .filter(facturaVenta -> tiposAutorizables.contains(facturaVenta.getTipoComprobante())) -// .forEach(this::autorizarFacturaVenta); + List tiposAutorizables = + Arrays.asList( + TipoDeComprobante.FACTURA_A, TipoDeComprobante.FACTURA_B, TipoDeComprobante.FACTURA_C); + facturasProcesadas.stream() + .filter(facturaVenta -> tiposAutorizables.contains(facturaVenta.getTipoComprobante())) + .forEach(this::autorizarFacturaVenta); return facturasProcesadas; } diff --git a/src/main/java/sic/service/impl/ReciboServiceImpl.java b/src/main/java/sic/service/impl/ReciboServiceImpl.java index beb1aa018..305529b1e 100644 --- a/src/main/java/sic/service/impl/ReciboServiceImpl.java +++ b/src/main/java/sic/service/impl/ReciboServiceImpl.java @@ -1,5 +1,6 @@ package sic.service.impl; +import java.io.ByteArrayOutputStream; import java.io.IOException; import java.math.BigDecimal; import java.net.URL; @@ -12,6 +13,9 @@ import com.mercadopago.resources.Payment; import com.querydsl.core.BooleanBuilder; import net.sf.jasperreports.engine.*; +import net.sf.jasperreports.engine.export.JRPdfExporter; +import net.sf.jasperreports.export.SimpleExporterInput; +import net.sf.jasperreports.export.SimpleOutputStreamExporterOutput; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -47,6 +51,7 @@ public class ReciboServiceImpl implements IReciboService { private final IPhotoVideoUploader photoVideoUploader; private final Logger logger = LoggerFactory.getLogger(this.getClass()); private static final int TAMANIO_PAGINA_DEFAULT = 25; + private static final String URL_SIN_IMAGEN = "https://res.cloudinary.com/hf0vu1bg2/image/upload/q_10/f_jpg/v1545616229/assets/sin_imagen.jpg"; private final MessageSource messageSource; private final CustomValidator customValidator; @@ -293,7 +298,13 @@ public Recibo guardarReciboPorDeposito(NuevoReciboDepositoDTO nuevoReciboDeposit if (nuevoReciboDepositoDTO.getIdPedido() != null && nuevoReciboDepositoDTO.getIdPedido() != 0L) { var pedidoRelacionadoAlDeposito = pedidoService.getPedidoNoEliminadoPorId(nuevoReciboDepositoDTO.getIdPedido()); - recibo.setSucursal(sucursalService.getSucursalPorId(pedidoRelacionadoAlDeposito.getIdSucursal())); + if (pedidoRelacionadoAlDeposito.getEstado() == EstadoPedido.CERRADO + || pedidoRelacionadoAlDeposito.getEstado() == EstadoPedido.CANCELADO) + throw new BusinessServiceException( + messageSource.getMessage( + "mensaje_recibo_deposito_sin_imagen", null, Locale.getDefault())); + recibo.setSucursal( + sucursalService.getSucursalPorId(pedidoRelacionadoAlDeposito.getIdSucursal())); recibo.setCliente(pedidoRelacionadoAlDeposito.getCliente()); recibo.setUsuario(pedidoRelacionadoAlDeposito.getUsuario()); } else { @@ -377,10 +388,6 @@ public List getRecibosEntreFechasPorFormaDePago( @Override public byte[] getReporteRecibo(Recibo recibo) { - if (recibo.getEstado() != EstadoRecibo.APROBADO) - throw new BusinessServiceException( - messageSource.getMessage( - "mensaje_recibo_reporte_no_aprobado", null, Locale.getDefault())); if (recibo.getProveedor() != null) { throw new BusinessServiceException( messageSource.getMessage("mensaje_recibo_reporte_proveedor", null, Locale.getDefault())); @@ -390,25 +397,46 @@ public byte[] getReporteRecibo(Recibo recibo) { if (recibo.getSucursal().getLogo() != null && !recibo.getSucursal().getLogo().isEmpty()) { try { params.put( - "logo", new ImageIcon(ImageIO.read(new URL(recibo.getSucursal().getLogo()))).getImage()); + "logo", + new ImageIcon(ImageIO.read(new URL(recibo.getSucursal().getLogo()))).getImage()); + params.put( + "sinImagen", new ImageIcon(ImageIO.read(new URL(URL_SIN_IMAGEN))).getImage()); } catch (IOException ex) { - throw new ServiceException(messageSource.getMessage( - "mensaje_sucursal_404_logo", null, Locale.getDefault()), ex); + throw new ServiceException( + messageSource.getMessage("mensaje_sucursal_404_logo", null, Locale.getDefault()), ex); } } - JasperReport jasperDesign; + JasperReport reporteRecibo; + JasperReport reporteComprobante; + JasperPrint printReporte; + JasperPrint printComprobante; + List reportes = new ArrayList<>(); try { - jasperDesign = JasperCompileManager.compileReport("src/main/resources/sic/vista/reportes/Recibo.jrxml"); + reporteRecibo = + JasperCompileManager.compileReport("src/main/resources/sic/vista/reportes/Recibo.jrxml"); + printReporte = JasperFillManager.fillReport(reporteRecibo, params); + reportes.add(printReporte); + if (recibo.getUrlImagen() != null) { + reporteComprobante = + JasperCompileManager.compileReport( + "src/main/resources/sic/vista/reportes/ComprobanteRecibo.jrxml"); + printComprobante = JasperFillManager.fillReport(reporteComprobante, params); + reportes.add(printComprobante); + } } catch (JRException ex) { - throw new ServiceException(messageSource.getMessage( - "mensaje_error_reporte", null, Locale.getDefault()), ex); + throw new ServiceException( + messageSource.getMessage("mensaje_error_reporte", null, Locale.getDefault()), ex); } try { - return JasperExportManager.exportReportToPdf( - JasperFillManager.fillReport(jasperDesign, params)); + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + JRPdfExporter exporter = new JRPdfExporter(); + exporter.setExporterInput(SimpleExporterInput.getInstance(reportes)); + exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(baos)); + exporter.exportReport(); + return baos.toByteArray(); } catch (JRException ex) { - throw new ServiceException(messageSource.getMessage( - "mensaje_error_reporte", null, Locale.getDefault()), ex); + throw new ServiceException( + messageSource.getMessage("mensaje_error_reporte", null, Locale.getDefault()), ex); } } diff --git a/src/main/resources/ValidationMessages.properties b/src/main/resources/ValidationMessages.properties index 3f12d45f1..40d2d9ea6 100644 --- a/src/main/resources/ValidationMessages.properties +++ b/src/main/resources/ValidationMessages.properties @@ -109,6 +109,7 @@ mensaje_recibo_concepto_vacio=El concepto se encuentra vacío mensaje_recibo_monto_igual_menor_cero=El monto del recibo debe ser superior a cero mensaje_recibo_fecha_vacia=La fecha del recibo se encuentra vacía mensaje_recibo_fecha_futura_no_permitida=La fecha del recibo debe ser actual o anterior +mensaje_recibo_sin_monto=El monto del recibo se encuentra vacío #Ubicacion mensaje_ubicacion_costoEnvio_negativo=El costo del envio no puede ser negativo diff --git a/src/main/resources/messages.properties b/src/main/resources/messages.properties index 7dea96ad5..231cd3ace 100644 --- a/src/main/resources/messages.properties +++ b/src/main/resources/messages.properties @@ -103,7 +103,6 @@ mensaje_recibo_cliente_proveedor_simultaneos=El recibo no puede poseer cliente y mensaje_recibo_reporte_proveedor=El recibo pertenece a una factura de compra. No posee reporte mensaje_recibo_no_existente=El recibo solicitado no existe mensaje_recibo_ya_aprobado=El recibo ya se encuentra aprobado -mensaje_recibo_reporte_no_aprobado=El recibo debe encontrarse aprobado para emitir el comprobante mensaje_recibo_deposito_sin_imagen=El recibo debe contener la imagen del comprobante #Sucursal diff --git a/src/main/resources/sic/vista/reportes/ComprobanteRecibo.jasper b/src/main/resources/sic/vista/reportes/ComprobanteRecibo.jasper new file mode 100644 index 0000000000000000000000000000000000000000..30d247057341d0ca684008e4c6cb6be6f0b1b15f GIT binary patch literal 31034 zcmeHwe|%iUb?><=S(2rdY)k&ZZwsde*!Z;?|78N^H#qv--Q>k1>@1)RTnYIMc zHkGM>z~mtQsV4Be7@azvicaiGOs1mASR_8VH=0bv5@VASv0X6=PZcezI6s;xV~{Z( zOMYR#FjQP9STUxA?^31AG)Qxx`*K-p?f|XK%@&Gfb3B8V87o&T9H5?DWjJ5VSVN-S zaIt8aWv*CBEzHkn%E!jcqo{5kpkAkFU(TB2vOQ)dYnCI0tlg?BS4rorys6s6s6B7a zSd!2|>L`|TW&sRGzW|j4hTQBNs9w%Dg2q7rz*H+y25OLB<_h*ums`b>jjikGoLLwv zvINt|N@kqer!v!rXUkwi)}r5vgZBfKnE{Vp3`o5gV73>sklPB$tzEgYIn88Qv^}t) zg`NhI3k9b^w6HJ_JYk7P@`1(Q?376+iL!&#mIb*L)2dk1cQCN0ktB}{RT+EMoXITY zt(0{vZ(6j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Rww|OTAEUPJ8;+Cd2Y;u6 z-*}v&e(;+W{N2ZCqaXZM1;0&EK~GfG`rXmv^ogpn-$U8&R+W9o%MChI1-}Dr_EwdB z6lH^Y*~bN&sb4R<_sh`Q&(R7YiccOFH;!EH9XeY8LaA@#S>dtp58p$t8af1kihFg{N+^bM>kKgPPUhH}OwGy{z|WbDLh5vQV& zpb9j@GNxg;Z=_?!Eil4&AfoV5x*1w>i}6`l&1dO0<2ic2@m;!uJ_QQSp|!uHU9EI~ z&lx=%Bdzpc(|UaH!@qzIzecxWrGKx{O!pYe=yCk}gwaBuH`<|z9rR-(Y^*UljZ2Jn z<5Hu`*lBbdaihmb80(B{jZ=(i;|$|Q<4ofg<80#&V}tQg;~e85<6Psj#(BoG#`(r` z##ZCI(Eby%!=Dywh)mqEpW_ZYfurRJ;vl?Rrk! + + + + + + + + + + + + + + + + + + + + + + + + + <band height="161" splitType="Stretch"> + <textField pattern="#0000"> + <reportElement x="459" y="15" width="43" height="15" uuid="6b61a93a-bc81-42c1-90de-30be6c6fd27b"> + <property name="local_mesure_unitheight" value="pixel"/> + <property name="com.jaspersoft.studio.unit.height" value="px"/> + </reportElement> + <textElement textAlignment="Right"> + <font size="8"/> + </textElement> + <textFieldExpression><![CDATA[$P{recibo}.getNumSerie()]]></textFieldExpression> + </textField> + <staticText> + <reportElement x="360" y="30" width="99" height="15" uuid="77044937-fc7c-464e-9cb7-28123e5819dc"> + <property name="com.jaspersoft.studio.unit.height" value="px"/> + </reportElement> + <textElement textAlignment="Left"> + <font size="8" isBold="true"/> + </textElement> + <text><![CDATA[Fecha:]]></text> + </staticText> + <textField pattern="dd/MM/yyyy"> + <reportElement x="459" y="30" width="96" height="15" uuid="be69d158-2a80-42ef-b029-4cff6ade861a"> + <property name="com.jaspersoft.studio.unit.height" value="px"/> + </reportElement> + <textElement textAlignment="Right"> + <font size="8"/> + </textElement> + <textFieldExpression><![CDATA[java.util.Date.from($P{recibo}.getFecha().atZone(java.time.ZoneId.systemDefault()).toInstant())]]></textFieldExpression> + </textField> + <textField> + <reportElement x="0" y="100" width="555" height="15" uuid="48165e8f-802d-48ab-b527-f040ad65579a"> + <property name="local_mesure_unitheight" value="pixel"/> + <property name="com.jaspersoft.studio.unit.height" value="px"/> + </reportElement> + <textElement> + <font size="8" isBold="true"/> + </textElement> + <textFieldExpression><![CDATA[$P{recibo}.getSucursal().getNombre()]]></textFieldExpression> + </textField> + <textField> + <reportElement x="0" y="115" width="555" height="15" uuid="6fb6fe21-b26a-4f5f-8847-da585e165dae"> + <property name="com.jaspersoft.studio.unit.height" value="px"/> + </reportElement> + <textElement> + <font size="8" isBold="false"/> + </textElement> + <textFieldExpression><![CDATA[($P{recibo}.getSucursal().getUbicacion() != null) ? +$P{recibo}.getSucursal().getUbicacion() : ""]]></textFieldExpression> + </textField> + <textField> + <reportElement x="0" y="130" width="555" height="15" uuid="3c596225-a4e6-4283-92e6-74a5552f2211"> + <property name="com.jaspersoft.studio.unit.height" value="px"/> + </reportElement> + <textElement> + <font size="8" isBold="false"/> + </textElement> + <textFieldExpression><![CDATA[$P{recibo}.getSucursal().getCategoriaIVA().toString().equals("RESPONSABLE_INSCRIPTO") ? "Responsable Inscripto" : +$P{recibo}.getSucursal().getCategoriaIVA().toString().equals("EXENTO") ? "Exento" : +$P{recibo}.getSucursal().getCategoriaIVA().toString().equals("CONSUMIDOR_FINAL") ? "Consumidor Final" : +$P{recibo}.getSucursal().getCategoriaIVA().toString().equals("MONOTRIBUTO") ? "Monotributo" : ""]]></textFieldExpression> + </textField> + <line> + <reportElement x="0" y="160" width="555" height="1" uuid="bbd9e748-9b14-42c1-b03e-08e8289d6627"/> + </line> + <image hAlign="Center" vAlign="Middle"> + <reportElement x="40" y="0" width="140" height="100" uuid="a3439a7b-148b-4af2-8d4b-612d8d0beb47"/> + <imageExpression><![CDATA[$P{logo}]]></imageExpression> + </image> + <textField> + <reportElement x="459" y="45" width="96" height="15" uuid="4d472ca2-fe0a-4f11-b2c2-eaff1fd6d51e"> + <property name="com.jaspersoft.studio.unit.height" value="px"/> + </reportElement> + <textElement textAlignment="Right"> + <font size="8"/> + </textElement> + <textFieldExpression><![CDATA[$P{recibo}.getSucursal().getIdFiscal()]]></textFieldExpression> + </textField> + <textField> + <reportElement x="459" y="60" width="96" height="15" uuid="4630ada4-f911-45f3-bf8d-1026e289cc77"> + <property name="com.jaspersoft.studio.unit.height" value="px"/> + </reportElement> + <textElement textAlignment="Right"> + <font size="8"/> + </textElement> + <textFieldExpression><![CDATA[$P{recibo}.getSucursal().getIngresosBrutos()]]></textFieldExpression> + </textField> + <textField pattern="dd/MM/yyyy" isBlankWhenNull="true"> + <reportElement x="459" y="75" width="96" height="15" uuid="71f82348-4ecf-4a46-9fcc-3681e588c04e"> + <property name="com.jaspersoft.studio.unit.height" value="px"/> + </reportElement> + <textElement textAlignment="Right"> + <font size="8"/> + </textElement> + <textFieldExpression><![CDATA[java.util.Date.from($P{recibo}.getSucursal().getFechaInicioActividad().atZone(java.time.ZoneId.systemDefault()).toInstant())]]></textFieldExpression> + </textField> + <textField> + <reportElement x="0" y="145" width="279" height="15" uuid="0ac9e3dd-2252-49da-8d4a-ae5da578c748"> + <property name="com.jaspersoft.studio.unit.height" value="px"/> + </reportElement> + <textElement> + <font size="8" isBold="false"/> + </textElement> + <textFieldExpression><![CDATA[$P{recibo}.getSucursal().getTelefono()]]></textFieldExpression> + </textField> + <textField> + <reportElement x="279" y="145" width="276" height="15" uuid="ecc2a8ba-e539-458c-93ed-17ae5e7a70df"> + <property name="com.jaspersoft.studio.unit.height" value="px"/> + </reportElement> + <textElement> + <font size="8" isBold="false"/> + </textElement> + <textFieldExpression><![CDATA[$P{recibo}.getSucursal().getEmail()]]></textFieldExpression> + </textField> + <textField pattern="#00000000"> + <reportElement x="510" y="15" width="45" height="15" uuid="a3046cbb-4b9c-4ffb-9c57-c20771497933"> + <property name="local_mesure_unitheight" value="pixel"/> + <property name="com.jaspersoft.studio.unit.height" value="px"/> + <property name="com.jaspersoft.studio.unit.width" value="pixel"/> + </reportElement> + <textElement textAlignment="Right"> + <font size="8"/> + </textElement> + <textFieldExpression><![CDATA[$P{recibo}.getNumRecibo()]]></textFieldExpression> + </textField> + <staticText> + <reportElement mode="Transparent" x="360" y="45" width="99" height="15" forecolor="#000000" backcolor="#FFFFFF" uuid="9e7dfcda-5c8c-4987-88c2-2b820976c1bf"/> + <box padding="0" topPadding="0" leftPadding="0" bottomPadding="0" rightPadding="0"/> + <textElement textAlignment="Left" verticalAlignment="Top" rotation="None" markup="none"> + <font size="8" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/> + <paragraph lineSpacing="Single" lineSpacingSize="1.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" tabStopWidth="40"/> + </textElement> + <text><![CDATA[CUIT:]]></text> + </staticText> + <staticText> + <reportElement mode="Transparent" x="360" y="60" width="99" height="15" forecolor="#000000" backcolor="#FFFFFF" uuid="b14c524c-faa9-4313-afa5-6d41ff2095b7"/> + <box padding="0" topPadding="0" leftPadding="0" bottomPadding="0" rightPadding="0"/> + <textElement textAlignment="Left" verticalAlignment="Top" rotation="None" markup="none"> + <font size="8" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/> + <paragraph lineSpacing="Single" lineSpacingSize="1.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" tabStopWidth="40"/> + </textElement> + <text><![CDATA[Ingresos Brutos:]]></text> + </staticText> + <staticText> + <reportElement mode="Transparent" x="360" y="75" width="99" height="15" forecolor="#000000" backcolor="#FFFFFF" uuid="65b16deb-9ce0-4137-ad4c-53495b7cdeaa"/> + <box padding="0" topPadding="0" leftPadding="0" bottomPadding="0" rightPadding="0"/> + <textElement textAlignment="Left" verticalAlignment="Top" rotation="None" markup="none"> + <font size="8" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/> + <paragraph lineSpacing="Single" lineSpacingSize="1.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" tabStopWidth="40"/> + </textElement> + <text><![CDATA[Inicio Actividades:]]></text> + </staticText> + <staticText> + <reportElement x="200" y="15" width="150" height="60" uuid="9f209d00-b442-47d4-a7bd-291fb3b1c8be"> + <property name="local_mesure_unitheight" value="pixel"/> + <property name="com.jaspersoft.studio.unit.height" value="px"/> + </reportElement> + <textElement textAlignment="Center" verticalAlignment="Middle"> + <font size="16" isBold="true"/> + </textElement> + <text><![CDATA[COMPROBANTE +RECIBO]]></text> + </staticText> + <staticText> + <reportElement mode="Transparent" x="360" y="15" width="99" height="15" forecolor="#000000" backcolor="#FFFFFF" uuid="4f584c9b-889f-4b77-ba6c-cfc29ead7cea"/> + <box padding="0" topPadding="0" leftPadding="0" bottomPadding="0" rightPadding="0"/> + <textElement textAlignment="Left" verticalAlignment="Top" rotation="None" markup="none"> + <font size="8" isBold="true" isItalic="false" isUnderline="false" isStrikeThrough="false" pdfEncoding="Cp1252" isPdfEmbedded="false"/> + <paragraph lineSpacing="Single" lineSpacingSize="1.0" firstLineIndent="0" leftIndent="0" rightIndent="0" spacingBefore="0" spacingAfter="0" tabStopWidth="40"/> + </textElement> + <text><![CDATA[Nº de Recibo:]]></text> + </staticText> + <staticText> + <reportElement x="502" y="15" width="8" height="15" uuid="94fd470d-5e8c-4022-b04a-2e1f3f304721"> + <property name="com.jaspersoft.studio.unit.width" value="pixel"/> + <property name="com.jaspersoft.studio.unit.height" value="pixel"/> + </reportElement> + <textElement textAlignment="Right" verticalAlignment="Justified"> + <font size="8"/> + </textElement> + <text><![CDATA[-]]></text> + </staticText> + </band> + + + + + + + + + + + + + + + + diff --git a/src/main/resources/sic/vista/reportes/Recibo.jasper b/src/main/resources/sic/vista/reportes/Recibo.jasper index a02a2be2a1b4d64d4d8a3cb032c81d5f9875a629..0d0944aa7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5y$Ge1~r6g=HPRFgC zZBva_Lczp>%e$=e*_t)$RDFCYiP*E#YGygu6Sn3l>AFrv3+%Y`JX(aU#Me6S@WiIWAAb^eOWe2cxo(f77NGjVT_aS z*BF?|!~$Ga@&Xc@>L98R|898PAy;mn5Qa4PBg z!#RirX_GS2gA#Y78QK`+!XrjHp1~QZ-qeg#Z)!)%+=)lZm>wP}-4q+=WIQLibGrI1 z-FO8bO>VP%Myo)EVWMo!nJ6=0qS=s4R7uxQbQq5=wPyD1dLUS) - + @@ -19,14 +19,6 @@ - - - - - - - - diff --git a/src/test/java/sic/integration/AppIntegrationTest.java b/src/test/java/sic/integration/AppIntegrationTest.java index 9c0d5ca50..f6ea5360f 100644 --- a/src/test/java/sic/integration/AppIntegrationTest.java +++ b/src/test/java/sic/integration/AppIntegrationTest.java @@ -1139,7 +1139,7 @@ void testEscenarioVenta1() { assertEquals(2, facturas.length); assertEquals(TipoDeComprobante.FACTURA_A, facturas[1].getTipoComprobante()); assertEquals(TipoDeComprobante.FACTURA_X, facturas[0].getTipoComprobante()); - //assertNotEquals(0L, facturas[1].getCae()); + assertNotEquals(0L, facturas[1].getCae()); assertNotNull( restTemplate.getForObject( apiPrefix + "/facturas/ventas/" + facturas[0].getIdFactura() + "/reporte", diff --git a/src/test/java/sic/service/impl/ReciboServiceImplTest.java b/src/test/java/sic/service/impl/ReciboServiceImplTest.java index bef7419d9..700bbf89c 100644 --- a/src/test/java/sic/service/impl/ReciboServiceImplTest.java +++ b/src/test/java/sic/service/impl/ReciboServiceImplTest.java @@ -11,6 +11,7 @@ import sic.exception.BusinessServiceException; import sic.modelo.*; import sic.modelo.criteria.BusquedaReciboCriteria; +import sic.modelo.dto.NuevoReciboDepositoDTO; import sic.repository.ReciboRepository; import sic.service.IConfiguracionSucursalService; import sic.service.IFormaDePagoService; @@ -215,4 +216,10 @@ void shouldValidarReglasDeNegocioWhenExisteUnPagoPorPaymentId() { verify(messageSource).getMessage(eq("mensaje_recibo_de_pago_ya_existente"), any(), any()); } + @Test + void should() { + NuevoReciboDepositoDTO nuevoReciboDepositoDTO = NuevoReciboDepositoDTO.builder() + .build(); + } + } From 6eb5ee3f65256a44884b51adeb24959420768180 Mon Sep 17 00:00:00 2001 From: Mayol Jose Date: Fri, 7 May 2021 00:47:47 -0300 Subject: [PATCH 06/11] Agrega dependencia --- pom.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pom.xml b/pom.xml index 06c25776a..74d305429 100644 --- a/pom.xml +++ b/pom.xml @@ -35,6 +35,11 @@ jjwt 0.9.1 + + com.lowagie + itext + 2.1.7.js7 + net.sf.jasperreports jasperreports From 521624bf69ecca4cd5a4ad1a7c8302ce790b6745 Mon Sep 17 00:00:00 2001 From: Mayol Jose Date: Fri, 7 May 2021 00:53:40 -0300 Subject: [PATCH 07/11] Agrega exclusion al pom --- pom.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pom.xml b/pom.xml index 74d305429..97e967564 100644 --- a/pom.xml +++ b/pom.xml @@ -44,6 +44,12 @@ net.sf.jasperreports jasperreports 6.16.0 + + + com.lowagie + itext + + org.apache.poi From f3e1a154f99788971fa5edcfb9565abf3c6485d8 Mon Sep 17 00:00:00 2001 From: Mayol Jose Date: Fri, 7 May 2021 01:03:08 -0300 Subject: [PATCH 08/11] =?UTF-8?q?Vuelve=20atr=C3=A1s=20los=20cambios=20sob?= =?UTF-8?q?re=20el=20pom?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/pom.xml b/pom.xml index 97e967564..06c25776a 100644 --- a/pom.xml +++ b/pom.xml @@ -35,21 +35,10 @@ jjwt 0.9.1 - - com.lowagie - itext - 2.1.7.js7 - net.sf.jasperreports jasperreports 6.16.0 - - - com.lowagie - itext - - org.apache.poi From 3b14a3fe60b61eb05b1065d8e8a69af40c8ae962 Mon Sep 17 00:00:00 2001 From: Mayol Jose Date: Fri, 7 May 2021 09:43:49 -0300 Subject: [PATCH 09/11] =?UTF-8?q?Modifica=20la=20validaci=C3=B3n=20para=20?= =?UTF-8?q?el=20alta=20de=20un=20recibo=20sobre=20un=20pedido=20no=20abier?= =?UTF-8?q?to.=20Modifica=20POM.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 11 +++++++++++ src/main/java/sic/service/impl/ReciboServiceImpl.java | 2 +- src/main/resources/messages.properties | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 06c25776a..97e967564 100644 --- a/pom.xml +++ b/pom.xml @@ -35,10 +35,21 @@ jjwt 0.9.1 + + com.lowagie + itext + 2.1.7.js7 + net.sf.jasperreports jasperreports 6.16.0 + + + com.lowagie + itext + + org.apache.poi diff --git a/src/main/java/sic/service/impl/ReciboServiceImpl.java b/src/main/java/sic/service/impl/ReciboServiceImpl.java index 305529b1e..bfc6801e1 100644 --- a/src/main/java/sic/service/impl/ReciboServiceImpl.java +++ b/src/main/java/sic/service/impl/ReciboServiceImpl.java @@ -302,7 +302,7 @@ public Recibo guardarReciboPorDeposito(NuevoReciboDepositoDTO nuevoReciboDeposit || pedidoRelacionadoAlDeposito.getEstado() == EstadoPedido.CANCELADO) throw new BusinessServiceException( messageSource.getMessage( - "mensaje_recibo_deposito_sin_imagen", null, Locale.getDefault())); + "mensaje_recibo_pedido_incorrecto", null, Locale.getDefault())); recibo.setSucursal( sucursalService.getSucursalPorId(pedidoRelacionadoAlDeposito.getIdSucursal())); recibo.setCliente(pedidoRelacionadoAlDeposito.getCliente()); diff --git a/src/main/resources/messages.properties b/src/main/resources/messages.properties index 231cd3ace..ed95ae650 100644 --- a/src/main/resources/messages.properties +++ b/src/main/resources/messages.properties @@ -104,6 +104,7 @@ mensaje_recibo_reporte_proveedor=El recibo pertenece a una factura de compra. No mensaje_recibo_no_existente=El recibo solicitado no existe mensaje_recibo_ya_aprobado=El recibo ya se encuentra aprobado mensaje_recibo_deposito_sin_imagen=El recibo debe contener la imagen del comprobante +mensaje_recibo_pedido_incorrecto=El pedido debe encontrarse abierto para realizar la operación #Sucursal mensaje_sucursal_duplicado_nombre=Ya existe una sucursal con el nombre ingresado From 836138072977f99d27d563e6313533baa5b62d2a Mon Sep 17 00:00:00 2001 From: Mayol Jose Date: Fri, 7 May 2021 09:55:27 -0300 Subject: [PATCH 10/11] =?UTF-8?q?Cambia=20la=20versi=C3=B3n=20de=20itext?= =?UTF-8?q?=20en=20el=20pom?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 97e967564..037b940f5 100644 --- a/pom.xml +++ b/pom.xml @@ -38,7 +38,7 @@ com.lowagie itext - 2.1.7.js7 + 4.2.2 net.sf.jasperreports From 6675e754053b18e975fe57455da92024ca6d4c6c Mon Sep 17 00:00:00 2001 From: Mayol Jose Date: Fri, 7 May 2021 10:19:13 -0300 Subject: [PATCH 11/11] Revierte cambios en el pom --- pom.xml | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/pom.xml b/pom.xml index 037b940f5..06c25776a 100644 --- a/pom.xml +++ b/pom.xml @@ -35,21 +35,10 @@ jjwt 0.9.1 - - com.lowagie - itext - 4.2.2 - net.sf.jasperreports jasperreports 6.16.0 - - - com.lowagie - itext - - org.apache.poi