0018330: Impressão de taxa de embarque W2I = null - AD-70

bug#18330
dev:thiago
qua:junia

git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@100292 d1611594-4594-4d17-8e1d-87c2c4800839
master
valdir 2020-02-19 12:47:07 +00:00
parent 418f4b09ba
commit a7b468506b
6 changed files with 168 additions and 3 deletions

View File

@ -26,5 +26,6 @@ public class ConstantesFuncionSistema {
public static final String CLAVE_RELATORIO_TROCO_SIMPLES = "COM.RJCONSULTORES.ADMINISTRACION.GUI.ESQUEMAOPERACIONAL.MENU.RELATORIOTROCOSIMPLES";
public static final String CLAVE_RELATORIO_ESTORNO_TROCO_SIMPLES = "COM.RJCONSULTORES.ADMINISTRACION.GUI.ESQUEMAOPERACIONAL.MENU.RELATORIOESTORNOTROCOSIMPLES";
public static final String CLAVE_CONFIG_EMITE_SOMENTE_CUPOM_EMBARQUE = "COM.RJCONSULTORES.ADMINISTRACION.GUI.CONFIGURACIONECCOMERCIALES.CONFIGTIPOPASSAGEM.EMITESOMENTECPEMB";
public static final String CLAVE_ESTOQUE_W2I = "COM.RJCONSULTORES.ADMINISTRACION.GUI.ESQUEMAOPERACIONAL.ESTOQUEW2I";
}

View File

@ -4,8 +4,14 @@
*/
package com.rjconsultores.ventaboletos.dao;
import com.rjconsultores.ventaboletos.entidad.Categoria;
import com.rjconsultores.ventaboletos.entidad.Empresa;
import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente;
import com.rjconsultores.ventaboletos.entidad.Parada;
import com.rjconsultores.ventaboletos.entidad.TaxaEmbarqueParada;
import com.rjconsultores.ventaboletos.vo.esquemaoperacional.TaxaEmbarqueW2i;
import java.sql.SQLException;
import java.util.List;
/**
@ -15,4 +21,6 @@ import java.util.List;
public interface TaxaEmbarqueParadaDAO extends GenericDAO<TaxaEmbarqueParada, Integer> {
public List<TaxaEmbarqueParada> buscarPorLocalidade(Parada parada);
public List<TaxaEmbarqueW2i> buscarEstoqueTaxaEmbarque(Parada origem, Empresa empresa, String txtKm, OrgaoConcedente orgao, Categoria categoria) throws SQLException;
}

View File

@ -4,10 +4,12 @@
*/
package com.rjconsultores.ventaboletos.dao.hibernate;
import com.rjconsultores.ventaboletos.dao.TaxaEmbarqueParadaDAO;
import com.rjconsultores.ventaboletos.entidad.Parada;
import com.rjconsultores.ventaboletos.entidad.TaxaEmbarqueParada;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang.StringUtils;
import org.hibernate.Criteria;
import org.hibernate.SessionFactory;
import org.hibernate.criterion.Restrictions;
@ -15,6 +17,15 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Repository;
import com.rjconsultores.ventaboletos.dao.TaxaEmbarqueParadaDAO;
import com.rjconsultores.ventaboletos.entidad.Categoria;
import com.rjconsultores.ventaboletos.entidad.Empresa;
import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente;
import com.rjconsultores.ventaboletos.entidad.Parada;
import com.rjconsultores.ventaboletos.entidad.TaxaEmbarqueParada;
import com.rjconsultores.ventaboletos.vo.esquemaoperacional.TaxaEmbarqueW2i;
import com.rjconsultores.ventaboletos.web.utilerias.NamedParameterStatement;
/**
*
* @author Desenvolvimento
@ -35,4 +46,63 @@ public class TaxaEmbarqueParadaHibernateDAO extends GenericHibernateDAO<TaxaEmba
return c.list();
}
public List<TaxaEmbarqueW2i> buscarEstoqueTaxaEmbarque(Parada origem, Empresa empresa, String txtKm, OrgaoConcedente orgao, Categoria categoria) throws SQLException {
List<TaxaEmbarqueW2i> listaEstoqueAux = new ArrayList<TaxaEmbarqueW2i>();
StringBuilder sql = new StringBuilder();
sql.append(" SELECT ");
sql.append(" C.TAXPOLC_ID taxpolc_id, EMP.NOMBEMPRESA nomeEmpresa, COALESCE(CS.DESCCATEGORIA, 'TODAS') categoria, P.cveParada, OC.DESCORGAO orgaoConcedente, C.KM km, ");
sql.append(" (SELECT COUNT(*) FROM TAXPOL E WHERE E.ACTIVO = 1 AND E.TAXPOLC_ID = C.TAXPOLC_ID ) quantidadeEstoque ");
sql.append(" FROM ");
sql.append(" TAXPOLC C INNER JOIN ");
sql.append(" EMPRESA EMP ON C.EMPRESA_ID = EMP.EMPRESA_ID INNER JOIN ");
sql.append(" PARADA P ON C.LOCALIDADE_ID = P.PARADA_ID LEFT JOIN ");
sql.append(" CATEGORIA CS ON C.CATEGORIA_ID = CS.CATEGORIA_ID INNER JOIN ");
sql.append(" ORGAO_CONCEDENTE OC ON C.ORGAOCONCEDENTE_ID = OC.ORGAOCONCEDENTE_ID ");
sql.append(" WHERE ");
sql.append(" C.ACTIVO = 1 AND ");
if(empresa != null) {
sql.append(" C.EMPRESA_ID = ").append(empresa.getEmpresaId()).append(" AND ");
}
if(StringUtils.isNotBlank(txtKm)) {
sql.append(" C.KM >= ").append(txtKm).append(" AND ");
}
if(categoria != null) {
sql.append(" (C.CATEGORIA_ID = ").append(categoria.getCategoriaId()).append(" OR C.CATEGORIA_ID IS NULL) AND ");
}
if(orgao != null) {
sql.append(" C.ORGAOCONCEDENTE_ID = ").append(orgao.getOrgaoConcedenteId()).append(" AND ");
}
sql.append(" C.LOCALIDADE_ID = ").append(origem.getParadaId());
sql.append(" ORDER BY ");
sql.append(" C.TAXPOLC_ID ");
NamedParameterStatement stmt = new NamedParameterStatement(getSession().connection(), sql.toString());
ResultSet rset = stmt.executeQuery();
while (rset.next()) {
TaxaEmbarqueW2i taxa = new TaxaEmbarqueW2i();
taxa.setTaxpolc_id(rset.getLong("taxpolc_id"));
taxa.setNomeEmpresa( rset.getString("nomeEmpresa"));
taxa.setCategoria(rset.getString("categoria"));
taxa.setCveParada(rset.getString("cveParada"));
taxa.setOrgaoConcedente(rset.getString("orgaoConcedente"));
taxa.setKm(rset.getLong("km"));
taxa.setQuantidadeEstoque(rset.getLong("quantidadeEstoque"));
listaEstoqueAux.add(taxa);
}
return listaEstoqueAux;
}
}

View File

@ -4,8 +4,14 @@
*/
package com.rjconsultores.ventaboletos.service;
import com.rjconsultores.ventaboletos.entidad.Categoria;
import com.rjconsultores.ventaboletos.entidad.Empresa;
import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente;
import com.rjconsultores.ventaboletos.entidad.Parada;
import com.rjconsultores.ventaboletos.entidad.TaxaEmbarqueParada;
import com.rjconsultores.ventaboletos.vo.esquemaoperacional.TaxaEmbarqueW2i;
import java.sql.SQLException;
import java.util.List;
/**
@ -15,4 +21,6 @@ import java.util.List;
public interface TaxaEmbarqueParadaService extends GenericService<TaxaEmbarqueParada, Integer> {
public List<TaxaEmbarqueParada> buscarPorLocalidade(Parada parada);
public List<TaxaEmbarqueW2i> buscarEstoqueTaxaEmbarque(Parada origem, Empresa empresa, String txtKm, OrgaoConcedente orgao, Categoria categoria) throws SQLException;
}

View File

@ -5,10 +5,16 @@
package com.rjconsultores.ventaboletos.service.impl;
import com.rjconsultores.ventaboletos.dao.TaxaEmbarqueParadaDAO;
import com.rjconsultores.ventaboletos.entidad.Categoria;
import com.rjconsultores.ventaboletos.entidad.Empresa;
import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente;
import com.rjconsultores.ventaboletos.entidad.Parada;
import com.rjconsultores.ventaboletos.entidad.TaxaEmbarqueParada;
import com.rjconsultores.ventaboletos.service.TaxaEmbarqueParadaService;
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
import com.rjconsultores.ventaboletos.vo.esquemaoperacional.TaxaEmbarqueW2i;
import java.sql.SQLException;
import java.util.Calendar;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
@ -59,4 +65,8 @@ public class TaxaEmbarqueParadaServiceImpl implements TaxaEmbarqueParadaService
public List<TaxaEmbarqueParada> buscarPorLocalidade(Parada parada) {
return taxaEmbarqueParadaDAO.buscarPorLocalidade(parada);
}
public List<TaxaEmbarqueW2i> buscarEstoqueTaxaEmbarque(Parada origem, Empresa empresa, String txtKm, OrgaoConcedente orgao, Categoria categoria) throws SQLException {
return taxaEmbarqueParadaDAO.buscarEstoqueTaxaEmbarque(origem, empresa, txtKm, orgao, categoria);
}
}

View File

@ -0,0 +1,68 @@
package com.rjconsultores.ventaboletos.vo.esquemaoperacional;
public class TaxaEmbarqueW2i {
private long taxpolc_id;
private String nomeEmpresa;
private String categoria;
private String cveParada;
private String orgaoConcedente;
private long km;
private long quantidadeEstoque;
public long getTaxpolc_id() {
return taxpolc_id;
}
public void setTaxpolc_id(long taxpolc_id) {
this.taxpolc_id = taxpolc_id;
}
public String getNomeEmpresa() {
return nomeEmpresa;
}
public void setNomeEmpresa(String nomeEmpresa) {
this.nomeEmpresa = nomeEmpresa;
}
public String getCategoria() {
return categoria;
}
public void setCategoria(String categoria) {
this.categoria = categoria;
}
public String getCveParada() {
return cveParada;
}
public void setCveParada(String cveParada) {
this.cveParada = cveParada;
}
public long getKm() {
return km;
}
public void setKm(long km) {
this.km = km;
}
public long getQuantidadeEstoque() {
return quantidadeEstoque;
}
public void setQuantidadeEstoque(long quantidadeEstoque) {
this.quantidadeEstoque = quantidadeEstoque;
}
public String getOrgaoConcedente() {
return orgaoConcedente;
}
public void setOrgaoConcedente(String orgaoConcedente) {
this.orgaoConcedente = orgaoConcedente;
}
}