Merge pull request 'fixes bug#AL-4419' (#14) from AL-4419 into master
Reviewed-on: adm/IntegracaoReceitaDespesa#14 Reviewed-by: Célio de Souza Ribeiro JR <celio@rjconsultores.com.br>master
commit
807bebb3ec
2
pom.xml
2
pom.xml
|
@ -3,7 +3,7 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>br.com.rjconsultores</groupId>
|
||||
<artifactId>IntegracaoReceitaDespesa</artifactId>
|
||||
<version>1.5.0</version>
|
||||
<version>1.6.0</version>
|
||||
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
|
|
|
@ -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<String> getDespesasReceitas(Integer puntoventaId, Integer empresaId, Date fechaParam, boolean incluiTipoPagamentoTurismoBGM, boolean isLayoutNovo) throws IntegracaoReceitaDespesaException{
|
||||
|
@ -560,6 +566,7 @@ public class Totalbus {
|
|||
}
|
||||
|
||||
public List<DespesaReceitaComporte> getDespesaCartaoDebCredComporte(final Integer puntoVentaId, final Integer empresaId, Date fechaParam, boolean incluiTipoPagamentoTurismoBGM) throws IntegracaoReceitaDespesaException{
|
||||
|
||||
List<DespesaReceitaComporte> despesas = new ArrayList<DespesaReceitaComporte>();
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue