From 3f57a19bafa1b471fcc124a121f5760ef11c62b4 Mon Sep 17 00:00:00 2001 From: "gleison.cruz" Date: Wed, 19 Jun 2024 23:47:57 -0300 Subject: [PATCH] fixes bug#AL-4419 --- pom.xml | 2 +- .../dao/Totalbus.java | 41 +++++++++++++++++-- 2 files changed, 38 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index 4305fe5c2..ede6579cb 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 br.com.rjconsultores IntegracaoReceitaDespesa - 1.5.0 + 1.6.0 diff --git a/src/com/rjconsultores/integracaoreceitadespesa/dao/Totalbus.java b/src/com/rjconsultores/integracaoreceitadespesa/dao/Totalbus.java index c9993e124..a1932efcb 100644 --- a/src/com/rjconsultores/integracaoreceitadespesa/dao/Totalbus.java +++ b/src/com/rjconsultores/integracaoreceitadespesa/dao/Totalbus.java @@ -27,6 +27,7 @@ public class Totalbus { private static final Logger log = LogManager.getLogger(Totalbus.class); private static final int DAYS_AGO = -1; + private Connection conn; @@ -42,6 +43,8 @@ public class Totalbus { private Boolean isLayoutNovo= false; private DecimalFormat df = new DecimalFormat("#0.00"); + + private int formaPagoCieloLink = 0; public Totalbus(Connection con, Boolean isReceitasDespesasComporte, Boolean isReceitasDespesasOuroPrata) { this.conn = con; @@ -49,6 +52,7 @@ public class Totalbus { this.isReceitasDespesasOuroPrata = isReceitasDespesasOuroPrata; loadEmpresas(); loadPuntosVenta(); + buscarFormaPagoCieloLink(); } public Totalbus(Connection con, Boolean isReceitasDespesasComporte,Boolean isCodReceitaFixoBgm, Boolean isReceitasDespesasOuroPrata) { @@ -58,6 +62,7 @@ public class Totalbus { this.isCodReceitaFixoBgm = isCodReceitaFixoBgm; loadEmpresas(); loadPuntosVenta(); + buscarFormaPagoCieloLink(); } public Totalbus(Connection con, Boolean isReceitasDespesasComporte,Boolean isCodReceitaFixoBgm, Boolean isReceitasDespesasOuroPrata, Boolean isLayoutNovo) { @@ -68,6 +73,7 @@ public class Totalbus { this.isLayoutNovo = isLayoutNovo; loadEmpresas(); loadPuntosVenta(); + buscarFormaPagoCieloLink(); } public List getDespesasReceitas(Integer puntoventaId, Integer empresaId, Date fechaParam, boolean incluiTipoPagamentoTurismoBGM, boolean isLayoutNovo) throws IntegracaoReceitaDespesaException{ @@ -560,6 +566,7 @@ public class Totalbus { } public List getDespesaCartaoDebCredComporte(final Integer puntoVentaId, final Integer empresaId, Date fechaParam, boolean incluiTipoPagamentoTurismoBGM) throws IntegracaoReceitaDespesaException{ + List despesas = new ArrayList(); StringBuilder sb = new StringBuilder(); sb.append(" select "); @@ -592,7 +599,7 @@ public class Totalbus { adicionaFiltroQuery(puntoVentaId, sb, " and cd.puntoventa_id = ", puntoVentaId != null && !puntoVentaId.equals(-1)); adicionaFiltroQuery(empresaId, sb, " and e.empresa_id = ", empresaId != null); sb.append(" and cd.activo = 1 "); - sb.append(" and cdp.formapago_id in (2,3) "); + sb.append(" and cdp.formapago_id in (2,3," +formaPagoCieloLink+ ") "); sb.append(" and tee.indtipo = 0 "); PreparedStatement stmt = null; @@ -632,7 +639,7 @@ public class Totalbus { } despesa.setFormaPagamentoId(rs.getString("formapagoId")); - if( despesa.getFormaPagamentoId().equals("2") || despesa.getFormaPagamentoId().equals("3")) { + if( despesa.getFormaPagamentoId().equals("2") || despesa.getFormaPagamentoId().equals("3") || despesa.getFormaPagamentoId().equals(formaPagoCieloLink)) { despesa.setCodigoAutorizacao(rs.getString("numautorizacion")); despesa.setNumeroEstabelecimento(rs.getString("numeroEstabelecimento")); }else { @@ -1411,7 +1418,33 @@ public class Totalbus { } return despesas; } - - + private void buscarFormaPagoCieloLink() { + PreparedStatement pstmt = null; + ResultSet rs = null; + + try { + pstmt = getConnection().prepareStatement("Select formapago_id from forma_pago where tipo_carteira_digital = 'CIELO_LINK' and activo = 1"); + rs = pstmt.executeQuery(); + if (rs.getFetchSize() > 0) { + while (rs.next()) { + formaPagoCieloLink = rs.getInt(1); + } + } + } catch (Exception e) { + log.error(e.getMessage(), e); + } finally { + try { + rs.close(); + } catch (Exception ignore) { + log.error(ignore.getMessage(), ignore); + } + try { + pstmt.close(); + } catch (Exception ignore) { + log.error(ignore.getMessage(), ignore); + } + } + } + }