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>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>br.com.rjconsultores</groupId>
|
<groupId>br.com.rjconsultores</groupId>
|
||||||
<artifactId>IntegracaoReceitaDespesa</artifactId>
|
<artifactId>IntegracaoReceitaDespesa</artifactId>
|
||||||
<version>1.5.0</version>
|
<version>1.6.0</version>
|
||||||
|
|
||||||
<distributionManagement>
|
<distributionManagement>
|
||||||
<repository>
|
<repository>
|
||||||
|
|
|
@ -28,6 +28,7 @@ public class Totalbus {
|
||||||
private static final Logger log = LogManager.getLogger(Totalbus.class);
|
private static final Logger log = LogManager.getLogger(Totalbus.class);
|
||||||
private static final int DAYS_AGO = -1;
|
private static final int DAYS_AGO = -1;
|
||||||
|
|
||||||
|
|
||||||
private Connection conn;
|
private Connection conn;
|
||||||
|
|
||||||
private List<PuntoVenta> pontosVenda = new ArrayList<PuntoVenta>();
|
private List<PuntoVenta> pontosVenda = new ArrayList<PuntoVenta>();
|
||||||
|
@ -43,12 +44,15 @@ public class Totalbus {
|
||||||
|
|
||||||
private DecimalFormat df = new DecimalFormat("#0.00");
|
private DecimalFormat df = new DecimalFormat("#0.00");
|
||||||
|
|
||||||
|
private int formaPagoCieloLink = 0;
|
||||||
|
|
||||||
public Totalbus(Connection con, Boolean isReceitasDespesasComporte, Boolean isReceitasDespesasOuroPrata) {
|
public Totalbus(Connection con, Boolean isReceitasDespesasComporte, Boolean isReceitasDespesasOuroPrata) {
|
||||||
this.conn = con;
|
this.conn = con;
|
||||||
this.isReceitasDespesasComporte = isReceitasDespesasComporte;
|
this.isReceitasDespesasComporte = isReceitasDespesasComporte;
|
||||||
this.isReceitasDespesasOuroPrata = isReceitasDespesasOuroPrata;
|
this.isReceitasDespesasOuroPrata = isReceitasDespesasOuroPrata;
|
||||||
loadEmpresas();
|
loadEmpresas();
|
||||||
loadPuntosVenta();
|
loadPuntosVenta();
|
||||||
|
buscarFormaPagoCieloLink();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Totalbus(Connection con, Boolean isReceitasDespesasComporte,Boolean isCodReceitaFixoBgm, Boolean isReceitasDespesasOuroPrata) {
|
public Totalbus(Connection con, Boolean isReceitasDespesasComporte,Boolean isCodReceitaFixoBgm, Boolean isReceitasDespesasOuroPrata) {
|
||||||
|
@ -58,6 +62,7 @@ public class Totalbus {
|
||||||
this.isCodReceitaFixoBgm = isCodReceitaFixoBgm;
|
this.isCodReceitaFixoBgm = isCodReceitaFixoBgm;
|
||||||
loadEmpresas();
|
loadEmpresas();
|
||||||
loadPuntosVenta();
|
loadPuntosVenta();
|
||||||
|
buscarFormaPagoCieloLink();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Totalbus(Connection con, Boolean isReceitasDespesasComporte,Boolean isCodReceitaFixoBgm, Boolean isReceitasDespesasOuroPrata, Boolean isLayoutNovo) {
|
public Totalbus(Connection con, Boolean isReceitasDespesasComporte,Boolean isCodReceitaFixoBgm, Boolean isReceitasDespesasOuroPrata, Boolean isLayoutNovo) {
|
||||||
|
@ -68,6 +73,7 @@ public class Totalbus {
|
||||||
this.isLayoutNovo = isLayoutNovo;
|
this.isLayoutNovo = isLayoutNovo;
|
||||||
loadEmpresas();
|
loadEmpresas();
|
||||||
loadPuntosVenta();
|
loadPuntosVenta();
|
||||||
|
buscarFormaPagoCieloLink();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getDespesasReceitas(Integer puntoventaId, Integer empresaId, Date fechaParam, boolean incluiTipoPagamentoTurismoBGM, boolean isLayoutNovo) throws IntegracaoReceitaDespesaException{
|
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{
|
public List<DespesaReceitaComporte> getDespesaCartaoDebCredComporte(final Integer puntoVentaId, final Integer empresaId, Date fechaParam, boolean incluiTipoPagamentoTurismoBGM) throws IntegracaoReceitaDespesaException{
|
||||||
|
|
||||||
List<DespesaReceitaComporte> despesas = new ArrayList<DespesaReceitaComporte>();
|
List<DespesaReceitaComporte> despesas = new ArrayList<DespesaReceitaComporte>();
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append(" select ");
|
sb.append(" select ");
|
||||||
|
@ -592,7 +599,7 @@ public class Totalbus {
|
||||||
adicionaFiltroQuery(puntoVentaId, sb, " and cd.puntoventa_id = ", puntoVentaId != null && !puntoVentaId.equals(-1));
|
adicionaFiltroQuery(puntoVentaId, sb, " and cd.puntoventa_id = ", puntoVentaId != null && !puntoVentaId.equals(-1));
|
||||||
adicionaFiltroQuery(empresaId, sb, " and e.empresa_id = ", empresaId != null);
|
adicionaFiltroQuery(empresaId, sb, " and e.empresa_id = ", empresaId != null);
|
||||||
sb.append(" and cd.activo = 1 ");
|
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 ");
|
sb.append(" and tee.indtipo = 0 ");
|
||||||
|
|
||||||
PreparedStatement stmt = null;
|
PreparedStatement stmt = null;
|
||||||
|
@ -632,7 +639,7 @@ public class Totalbus {
|
||||||
}
|
}
|
||||||
despesa.setFormaPagamentoId(rs.getString("formapagoId"));
|
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.setCodigoAutorizacao(rs.getString("numautorizacion"));
|
||||||
despesa.setNumeroEstabelecimento(rs.getString("numeroEstabelecimento"));
|
despesa.setNumeroEstabelecimento(rs.getString("numeroEstabelecimento"));
|
||||||
}else {
|
}else {
|
||||||
|
@ -1412,6 +1419,32 @@ public class Totalbus {
|
||||||
return despesas;
|
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