fixes bug#15005
dev: julio qua: git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@95823 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
d3250cdbe0
commit
1a9089f3ff
|
@ -52,13 +52,8 @@ public class BpeHibernateDAO extends HibernateDaoSupport implements BpeDAO {
|
|||
|
||||
log.info("Inicio da consulta buscarRegistroExportacaoBpe: " + new Date());
|
||||
|
||||
ConstanteService constanteService = (ConstanteService) AppContext.getApplicationContext().getBean("constanteService");
|
||||
Constante contante = constanteService.buscarPorNomeConstante("IMPORT_BPE_LAYOUT_DIF");
|
||||
String valorConstante = contante == null ? null : contante.getValorconstante();
|
||||
|
||||
boolean isVersao131 = StringUtils.isBlank(valorConstante) ? true : false;
|
||||
|
||||
List<ExportacaoBPEBase> registros = consultaRegistroExportacaoBpe(connection, inicio, fim, empresaId, cveestado, isVersao131);
|
||||
boolean isNoXml = isNoXml();
|
||||
List<ExportacaoBPEBase> registros = consultaRegistroExportacaoBpe(connection, inicio, fim, empresaId, cveestado, isNoXml);
|
||||
|
||||
/*
|
||||
* Bilhetes emitidos dentro do mes for cancelados apenas informar o cancelamento; Bilhetes emitidos em um mês e cancelados em outro mês, este deve ir apenas no relatório de devolução;
|
||||
|
@ -78,7 +73,7 @@ public class BpeHibernateDAO extends HibernateDaoSupport implements BpeDAO {
|
|||
|
||||
for (Map.Entry<String, ExportacaoBPEBase> pair : mapAux.entrySet()) {
|
||||
|
||||
if (isVersao131) {
|
||||
if (isNoXml) {
|
||||
listaRegistroBaseBPE.add(ExportacaoBPEVo.gerarListas(pair.getValue()));
|
||||
} else {
|
||||
listaRegistroBaseBPE.add(ExportacaoBPEVo.gerarListasXML(pair.getValue()));
|
||||
|
@ -93,11 +88,11 @@ public class BpeHibernateDAO extends HibernateDaoSupport implements BpeDAO {
|
|||
return resp;
|
||||
}
|
||||
|
||||
private List<ExportacaoBPEBase> consultaRegistroExportacaoBpe(Connection connection, Date inicio, Date fim, Integer empresaId, String cveestado, boolean isVersao131) {
|
||||
private List<ExportacaoBPEBase> consultaRegistroExportacaoBpe(Connection connection, Date inicio, Date fim, Integer empresaId, String cveestado, boolean isNoXml) {
|
||||
List<ExportacaoBPEBase> registros = new ArrayList<ExportacaoBPEBase>();
|
||||
|
||||
String sql = null;
|
||||
if (isVersao131) {
|
||||
if (isNoXml) {
|
||||
sql = queryNoXml();
|
||||
} else {
|
||||
sql = queryXml();
|
||||
|
@ -112,7 +107,7 @@ public class BpeHibernateDAO extends HibernateDaoSupport implements BpeDAO {
|
|||
ps.setLong(3, Long.valueOf(empresaId));
|
||||
ps.setString(4, cveestado);
|
||||
|
||||
ps.setFetchSize(99999);
|
||||
ps.setFetchSize(999);
|
||||
ResultSet rs = ps.executeQuery();
|
||||
|
||||
while (rs.next()) {
|
||||
|
@ -162,7 +157,7 @@ public class BpeHibernateDAO extends HibernateDaoSupport implements BpeDAO {
|
|||
registro.setValortributado(valortributado);
|
||||
registro.setValortotal(valortotal);
|
||||
|
||||
if (isVersao131) {
|
||||
if (isNoXml) {
|
||||
registro.setCmunini(rs.getString("cmunini"));
|
||||
registro.setCmunfim(rs.getString("cmunfim"));
|
||||
registro.setUfini(rs.getString("ufini"));
|
||||
|
@ -225,6 +220,17 @@ public class BpeHibernateDAO extends HibernateDaoSupport implements BpeDAO {
|
|||
return registros;
|
||||
}
|
||||
|
||||
private boolean isNoXml() {
|
||||
ConstanteService constanteService = (ConstanteService) AppContext.getApplicationContext().getBean("constanteService");
|
||||
Constante contante = constanteService.buscarPorNomeConstante("IMPORT_BPE_NOXML");
|
||||
String valorConstante = contante == null ? null : contante.getValorconstante();
|
||||
|
||||
if (StringUtils.isBlank(valorConstante))
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
private String queryNoXml() {
|
||||
StringBuilder sql = new StringBuilder();
|
||||
sql.append("select /*+INDEX(BPE IDX__BPE_BOLETO)*/ ");
|
||||
|
|
|
@ -288,17 +288,20 @@ public class ExportacaoBPEVo {
|
|||
|
||||
if (comp.getTpComp().equals(TipoComp.PEDAGIO)) {
|
||||
vPedagio = (isInterMunicipal && !registro.getIndPedadioEstdual()) ? (comp.getVComp() == null ? "0.0" : comp.getVComp()) : "0.0";
|
||||
vPedagio = (!isInterMunicipal && !registro.getIndPedagioMunicipal()) ? (comp.getVComp() == null ? "0.0" : comp.getVComp()) : "0.0";
|
||||
if (vPedagio.equals("0.0"))
|
||||
vPedagio = (!isInterMunicipal && !registro.getIndPedagioMunicipal()) ? (comp.getVComp() == null ? "0.0" : comp.getVComp()) : "0.0";
|
||||
}
|
||||
|
||||
if (comp.getTpComp().equals(TipoComp.TAXA_EMBARQUE)) {
|
||||
vTxEmbarque = (isInterMunicipal && !registro.getIndTxEmbarqueEstadual()) ? (comp.getVComp() == null ? "0.0" : comp.getVComp()) : "0.0";
|
||||
vTxEmbarque = (!isInterMunicipal && !registro.getIndTxEmbarqueMunicipal()) ? (comp.getVComp() == null ? "0.0" : comp.getVComp()) : "0.0";
|
||||
if (vTxEmbarque.equals("0.0"))
|
||||
vTxEmbarque = (!isInterMunicipal && !registro.getIndTxEmbarqueMunicipal()) ? (comp.getVComp() == null ? "0.0" : comp.getVComp()) : "0.0";
|
||||
}
|
||||
|
||||
if (comp.getTpComp().equals(TipoComp.SEGURO)) {
|
||||
vSeguro = (isInterMunicipal && !registro.getIndSeguroEstadual()) ? (comp.getVComp() == null ? "0.0" : comp.getVComp()) : "0.0";
|
||||
vSeguro = (!isInterMunicipal && !registro.getIndSeguroMunicipal()) ? (comp.getVComp() == null ? "0.0" : comp.getVComp()) : "0.0";
|
||||
if (vSeguro.equals("0.0"))
|
||||
vSeguro = (!isInterMunicipal && !registro.getIndSeguroMunicipal()) ? (comp.getVComp() == null ? "0.0" : comp.getVComp()) : "0.0";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue