fixes bug#13037
dev:Ramires qua:Renato git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@89687 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
a7cebf7b2b
commit
00b2f5f8cf
|
@ -21,6 +21,7 @@ import com.rjconsultores.ventaboletos.entidad.Via;
|
|||
import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa;
|
||||
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
||||
import com.rjconsultores.ventaboletos.service.TarifaService;
|
||||
import com.rjconsultores.ventaboletos.vo.comissao.TarifaVO;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -73,6 +74,8 @@ public interface TarifaDAO extends GenericDAO<Tarifa, Integer> {
|
|||
public boolean existeTarifas(VigenciaTarifa vigenciaTarifa);
|
||||
|
||||
public void excluirTodasTarifas(Moneda moneda, Marca marca, ClaseServicio claseServicio, VigenciaTarifa vigenciaTarifa, Parada origem,
|
||||
Parada destino, Categoria categoria, TipoPuntoVenta tipoPuntoVenta, Ruta ruta, Via via);
|
||||
Parada destino, Categoria categoria, TipoPuntoVenta tipoPuntoVenta, Ruta ruta, Via via);
|
||||
public List<TarifaVO> obterTarifaOficialPorFiltroVO(Moneda moneda, Marca marca,List<Marca>lsMarcas, Parada origem, Parada destino, ClaseServicio claseServicio, VigenciaTarifa vigenciaTarifa,Categoria categoria,TipoPuntoVenta tipoPuntoVenta, Ruta ruta, Via via,Boolean vende);
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -3,12 +3,17 @@ package com.rjconsultores.ventaboletos.dao;
|
|||
import java.util.List;
|
||||
|
||||
import com.rjconsultores.ventaboletos.constantes.TipoSeguro;
|
||||
import com.rjconsultores.ventaboletos.entidad.ClaseServicio;
|
||||
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||
import com.rjconsultores.ventaboletos.entidad.Marca;
|
||||
import com.rjconsultores.ventaboletos.entidad.Moneda;
|
||||
import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente;
|
||||
import com.rjconsultores.ventaboletos.entidad.Parada;
|
||||
import com.rjconsultores.ventaboletos.entidad.Ruta;
|
||||
import com.rjconsultores.ventaboletos.entidad.TarifaOficial;
|
||||
import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa;
|
||||
import com.rjconsultores.ventaboletos.service.TarifaOficialService;
|
||||
import com.rjconsultores.ventaboletos.vo.comissao.TarifaOficialVO;
|
||||
|
||||
public interface TarifaOficialDAO extends GenericDAO<TarifaOficial, Integer> {
|
||||
/**
|
||||
|
@ -91,4 +96,6 @@ public interface TarifaOficialDAO extends GenericDAO<TarifaOficial, Integer> {
|
|||
public void atualizarPrecioPorTPP(Integer rutaId, Integer orgaoId, Integer usuarioId, TipoSeguro tipoSeguro);
|
||||
|
||||
public long obtenerCount(List<Empresa> lsEmpresaSelected);
|
||||
|
||||
public List<TarifaOficialVO> obterTarifaOficialPorFiltroVO(Moneda moneda, Marca marca,List<Marca> lsMarcas,Parada origem, Parada destino, ClaseServicio claseServicio, Ruta ruta, String numRuta, Boolean vende);
|
||||
}
|
||||
|
|
|
@ -9,11 +9,13 @@ import java.util.List;
|
|||
import org.apache.commons.lang.Validate;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.hibernate.Criteria;
|
||||
import org.hibernate.Hibernate;
|
||||
import org.hibernate.Query;
|
||||
import org.hibernate.SQLQuery;
|
||||
import org.hibernate.SessionFactory;
|
||||
import org.hibernate.criterion.Projections;
|
||||
import org.hibernate.criterion.Restrictions;
|
||||
import org.hibernate.transform.Transformers;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
@ -36,6 +38,7 @@ import com.rjconsultores.ventaboletos.entidad.Via;
|
|||
import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa;
|
||||
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||
import com.rjconsultores.ventaboletos.vo.comissao.TarifaVO;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -336,4 +339,112 @@ public class TarifaHibernateDAO extends GenericHibernateDAO<Tarifa, Integer> imp
|
|||
sq.executeUpdate();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public List<TarifaVO> obterTarifaOficialPorFiltroVO(Moneda moneda, Marca marca, List<Marca> lsMarcas, Parada origem, Parada destino, ClaseServicio claseServicio, VigenciaTarifa vigenciaTarifa, Categoria categoria, TipoPuntoVenta tipoPuntoVenta, Ruta ruta, Via via, Boolean vende) {
|
||||
|
||||
StringBuilder sql = new StringBuilder(" SELECT ");
|
||||
sql.append(" t.tarifa_id tarifaid,");
|
||||
sql.append(" t.PRECIO precio,");
|
||||
sql.append(" t.PRECIOORIGINAL preciooriginal,");
|
||||
sql.append(" t.IMPORTEPEDAGIO importepedagio,");
|
||||
sql.append(" t.IMPORTETAXAEMBARQUE importetaxaembarque,");
|
||||
sql.append(" t.IMPORTESEGURO importeseguro,");
|
||||
sql.append(" t.IMPORTETPP importetpp,");
|
||||
sql.append(" t.IMPORTEOUTROS importeoutros,");
|
||||
sql.append(" t.STATUSTARIFA statustarifa,");
|
||||
sql.append(" origem.DESCPARADA descparadaOrigem,");
|
||||
sql.append(" destino.DESCPARADA descparadaDestino,");
|
||||
sql.append(" via.NOMBVIA nomeVia,");
|
||||
sql.append(" ma.DESCMARCA descMarca,");
|
||||
sql.append(" v.FECINICIOVIGENCIA feciniciovigencia,");
|
||||
sql.append(" v.FECFINVIGENCIA fecfimvigencia,");
|
||||
sql.append(" cl.DESCCLASE descclasse,");
|
||||
sql.append(" oc.DESCORGAO descorgao,");
|
||||
sql.append(" r.prefixo rutaprefixo,");
|
||||
sql.append(" r.numruta numruta");
|
||||
sql.append(" FROM TARIFA t");
|
||||
sql.append(" LEFT JOIN TRAMO tr on (tr.TRAMO_ID = t.TRAMO_ID)");
|
||||
sql.append(" LEFT JOIN VIA via on (VIA.VIA_ID=tr.VIA_ID)");
|
||||
sql.append(" LEFT JOIN PARADA origem on (origem.PARADA_ID=tr.ORIGEN_ID)");
|
||||
sql.append(" LEFT JOIN PARADA destino on (destino.PARADA_ID=tr.DESTINO_ID)");
|
||||
sql.append(" LEFT JOIN PARADA destino on (destino.PARADA_ID=tr.DESTINO_ID)");
|
||||
sql.append(" LEFT JOIN MARCA ma on (ma.MARCA_ID = t.MARCA_ID)");
|
||||
sql.append(" LEFT JOIN VIGENCIA_TARIFA v on (v.VIGENCIATARIFA_ID = t.VIGENCIATARIFA_ID)");
|
||||
sql.append(" LEFT JOIN ruta r ON ( r.ruta_id = t.ruta_id )");
|
||||
sql.append(" LEFT JOIN CLASE_SERVICIO cl ON (cl.CLASESERVICIO_ID=t.CLASESERVICIO_ID)");
|
||||
sql.append(" LEFT JOIN ORGAO_CONCEDENTE oc ON (oc.ORGAOCONCEDENTE_ID=t.ORGAOCONCEDENTE_ID)");
|
||||
if (categoria != null) {
|
||||
sql.append(" LEFT JOIN TARIFA_CATEGORIA tc on (tc.TARIFA_ID = t.TARIFA_ID) ");
|
||||
}
|
||||
if (tipoPuntoVenta != null) {
|
||||
sql.append("LEFT JOIN TARIFA_TIPOPTOVTA tt on (tt.TARIFA_ID = t.TARIFA_ID)");
|
||||
}
|
||||
|
||||
if(vende!=null){
|
||||
sql.append(" LEFT JOIN RUTA_COMBINACION rc on (rc.tramo_id = tr.tramo_id)");
|
||||
}
|
||||
sql.append(" WHERE ");
|
||||
sql.append(" t.activo=1 ");
|
||||
if (moneda != null) {
|
||||
sql.append(" and t.moneda_id=" + moneda.getMonedaId());
|
||||
}
|
||||
if (marca != null) {
|
||||
sql.append(" and t.marca_id=" + marca.getMarcaId());
|
||||
} else {
|
||||
String stringMarca =" and t.marca_id in (";
|
||||
int contador =0;
|
||||
for(Marca m:lsMarcas){
|
||||
if(contador==0){
|
||||
stringMarca=stringMarca+m.getMarcaId().toString();
|
||||
}else{
|
||||
stringMarca=stringMarca+","+m.getMarcaId();
|
||||
}
|
||||
contador++;
|
||||
if(lsMarcas.size()==contador){
|
||||
stringMarca=stringMarca+")";
|
||||
}
|
||||
}
|
||||
sql.append(stringMarca);
|
||||
|
||||
}
|
||||
if(ruta!=null){
|
||||
sql.append(" and t.ruta_id=" + ruta.getRutaId());
|
||||
}
|
||||
if (origem != null) {
|
||||
sql.append(" and origem.parada_id=" + origem.getParadaId());
|
||||
}
|
||||
if (destino != null) {
|
||||
sql.append(" and destino.parada_id=" + destino.getParadaId());
|
||||
}
|
||||
if (claseServicio != null) {
|
||||
sql.append(" and t.claseservicio_id=" + claseServicio.getClaseservicioId());
|
||||
}
|
||||
if (vigenciaTarifa != null) {
|
||||
sql.append(" and t.vigenciatarifa_id=" + vigenciaTarifa.getVigenciatarifaId());
|
||||
}
|
||||
if (categoria != null) {
|
||||
sql.append(" and tc.categoria_id=" + categoria.getCategoriaId());
|
||||
}
|
||||
if (vigenciaTarifa != null) {
|
||||
sql.append(" and t.vigenciatarifa_id=" + vigenciaTarifa.getVigenciatarifaId());
|
||||
}
|
||||
if (via != null) {
|
||||
sql.append(" and via.via_id=" + via.getViaId());
|
||||
}
|
||||
if (tipoPuntoVenta != null) {
|
||||
sql.append(" and tt.tipoptovta_id=" +tipoPuntoVenta.getTipoptovtaId());
|
||||
}
|
||||
if(vende!=null){
|
||||
int simNao=vende?1:0;
|
||||
sql.append(" and rc.tramo_id=t.tramo_id and rc.ruta_id=t.ruta_id and rc.activo=1 and rc.INDVENTA="+simNao);
|
||||
}
|
||||
|
||||
Query qr = getSession().createSQLQuery(sql.toString()).addScalar("tarifaid", Hibernate.INTEGER).addScalar("precio", Hibernate.BIG_DECIMAL).addScalar("preciooriginal", Hibernate.BIG_DECIMAL).addScalar("importepedagio", Hibernate.BIG_DECIMAL).addScalar("importetaxaembarque", Hibernate.BIG_DECIMAL).addScalar("importeseguro", Hibernate.BIG_DECIMAL).addScalar("importetpp", Hibernate.BIG_DECIMAL).addScalar("importeoutros", Hibernate.BIG_DECIMAL).addScalar("statustarifa", Hibernate.STRING).addScalar("descparadaOrigem", Hibernate.STRING).addScalar("descparadaDestino", Hibernate.STRING).addScalar("nomeVia", Hibernate.STRING).addScalar("descMarca", Hibernate.STRING).addScalar("feciniciovigencia", Hibernate.DATE).addScalar("fecfimvigencia", Hibernate.DATE).addScalar("descclasse", Hibernate.STRING).addScalar("descorgao", Hibernate.STRING).addScalar("rutaprefixo", Hibernate.STRING).addScalar("numruta", Hibernate.STRING).setResultTransformer(Transformers.aliasToBean(TarifaVO.class));
|
||||
qr.setMaxResults(5000);
|
||||
return (List<TarifaVO>) qr.list();
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import java.sql.Statement;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.hibernate.Hibernate;
|
||||
import org.hibernate.Query;
|
||||
import org.hibernate.SQLQuery;
|
||||
import org.hibernate.SessionFactory;
|
||||
|
@ -19,12 +20,17 @@ import org.springframework.stereotype.Repository;
|
|||
import com.rjconsultores.ventaboletos.constantes.TipoSeguro;
|
||||
import com.rjconsultores.ventaboletos.dao.TarifaOficialDAO;
|
||||
import com.rjconsultores.ventaboletos.dao.sqlbuilder.SQLBuilder;
|
||||
import com.rjconsultores.ventaboletos.entidad.ClaseServicio;
|
||||
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||
import com.rjconsultores.ventaboletos.entidad.Marca;
|
||||
import com.rjconsultores.ventaboletos.entidad.Moneda;
|
||||
import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente;
|
||||
import com.rjconsultores.ventaboletos.entidad.Parada;
|
||||
import com.rjconsultores.ventaboletos.entidad.Ruta;
|
||||
import com.rjconsultores.ventaboletos.entidad.TarifaOficial;
|
||||
import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa;
|
||||
import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties;
|
||||
import com.rjconsultores.ventaboletos.vo.comissao.TarifaOficialVO;
|
||||
|
||||
@Repository("tarifaOficialDAO")
|
||||
public class TarifaOficialHibernateDAO extends GenericHibernateDAO<TarifaOficial, Integer> implements TarifaOficialDAO {
|
||||
|
@ -161,14 +167,14 @@ public class TarifaOficialHibernateDAO extends GenericHibernateDAO<TarifaOficial
|
|||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void copiarParaTarifa(VigenciaTarifa vigenciaTarifa, Integer usuarioId, Boolean calculaPegagio, Boolean calculaTarifa, Boolean calculaTaxaEmbarque, Boolean calculaSeguro, Boolean calculaTPP, Empresa empresa, OrgaoConcedente orgaoConcedente) {
|
||||
//Apago antes as tarifas que podem estar como activo =0
|
||||
// Apago antes as tarifas que podem estar como activo =0
|
||||
apagarTarifasInativas(vigenciaTarifa, empresa, orgaoConcedente);
|
||||
|
||||
// Insiro as tarifas que não existem
|
||||
SQLQuery querySQL = getSession().createSQLQuery(sqlBuilder.getSQLInserirTarifaPelaTarifaOficial(vigenciaTarifa.getVigenciatarifaId(), usuarioId, empresa, orgaoConcedente));
|
||||
SQLQuery querySQL = getSession().createSQLQuery(sqlBuilder.getSQLInserirTarifaPelaTarifaOficial(vigenciaTarifa.getVigenciatarifaId(), usuarioId, empresa, orgaoConcedente));
|
||||
querySQL.executeUpdate();
|
||||
// Atualizo o preço e o componente dos preços que já existem
|
||||
querySQL = getSession().createSQLQuery(sqlBuilder.getSQLSelecionarTarifaPorTarifaOficalParaAtualizar(vigenciaTarifa.getVigenciatarifaId(), empresa, orgaoConcedente));
|
||||
querySQL = getSession().createSQLQuery(sqlBuilder.getSQLSelecionarTarifaPorTarifaOficalParaAtualizar(vigenciaTarifa.getVigenciatarifaId(), empresa, orgaoConcedente));
|
||||
querySQL.setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP);
|
||||
List<Map<String, Object>> dados = querySQL.list();
|
||||
for (Map<String, Object> dado : dados) {
|
||||
|
@ -335,7 +341,7 @@ public class TarifaOficialHibernateDAO extends GenericHibernateDAO<TarifaOficial
|
|||
sql.append(" when matched then ");
|
||||
sql.append(" update set ");
|
||||
sql.append(" importepedagio = tarifa_importe.soma ");
|
||||
}else{
|
||||
} else {
|
||||
sql.append(" merge into tarifa_oficial ");
|
||||
sql.append(" using ");
|
||||
sql.append(" ( ");
|
||||
|
@ -356,7 +362,6 @@ public class TarifaOficialHibernateDAO extends GenericHibernateDAO<TarifaOficial
|
|||
sql.append(" importepedagio = tarifa_importe.soma ");
|
||||
}
|
||||
|
||||
|
||||
Connection conn = getSession().connection();
|
||||
Statement stmt;
|
||||
try {
|
||||
|
@ -367,4 +372,89 @@ public class TarifaOficialHibernateDAO extends GenericHibernateDAO<TarifaOficial
|
|||
log.error("Erro na atualização do pedágio");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TarifaOficialVO> obterTarifaOficialPorFiltroVO(Moneda moneda, Marca marca, List<Marca> lsMarcas, Parada origem, Parada destino, ClaseServicio claseServicio, Ruta ruta, String numRuta, Boolean vende) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
StringBuilder sql = new StringBuilder(" SELECT ");
|
||||
sql.append(" t.tarifaoficial_id tarifaoficialid,");
|
||||
sql.append(" t.PRECIO precio,");
|
||||
sql.append(" t.PRECIOORIGINAL preciooriginal,");
|
||||
sql.append(" t.IMPORTEPEDAGIO importepedagio,");
|
||||
sql.append(" t.IMPORTETAXAEMBARQUE importetaxaembarque,");
|
||||
sql.append(" t.IMPORTESEGURO importeseguro,");
|
||||
sql.append(" t.IMPORTETPP importetpp,");
|
||||
sql.append(" t.IMPORTEOUTROS importeoutros,");
|
||||
sql.append(" origem.DESCPARADA descparadaOrigem,");
|
||||
sql.append(" destino.DESCPARADA descparadaDestino,");
|
||||
sql.append(" via.NOMBVIA nomeVia,");
|
||||
sql.append(" ma.DESCMARCA descMarca,");
|
||||
sql.append(" cl.DESCCLASE descclasse,");
|
||||
sql.append(" oc.DESCORGAO descorgao,");
|
||||
sql.append(" r.prefixo rutaprefixo,");
|
||||
sql.append(" r.numruta numruta");
|
||||
sql.append(" FROM TARIFA_OFICIAL t");
|
||||
sql.append(" LEFT JOIN TRAMO tr on (tr.TRAMO_ID = t.TRAMO_ID)");
|
||||
sql.append(" LEFT JOIN ruta r ON ( r.ruta_id = t.ruta_id )");
|
||||
sql.append(" LEFT JOIN VIA via on (VIA.VIA_ID=tr.VIA_ID)");
|
||||
sql.append(" LEFT JOIN PARADA origem on (origem.PARADA_ID=tr.ORIGEN_ID)");
|
||||
sql.append(" LEFT JOIN PARADA destino on (destino.PARADA_ID=tr.DESTINO_ID)");
|
||||
sql.append(" LEFT JOIN PARADA destino on (destino.PARADA_ID=tr.DESTINO_ID)");
|
||||
sql.append(" LEFT JOIN MARCA ma on (ma.MARCA_ID = t.MARCA_ID)");
|
||||
sql.append(" LEFT JOIN CLASE_SERVICIO cl ON (cl.CLASESERVICIO_ID=t.CLASESERVICIO_ID)");
|
||||
sql.append(" LEFT JOIN ORGAO_CONCEDENTE oc ON (oc.ORGAOCONCEDENTE_ID=t.ORGAOCONCEDENTE_ID)");
|
||||
|
||||
if (vende != null) {
|
||||
sql.append(" LEFT JOIN RUTA_COMBINACION rc on (rc.tramo_id = tr.tramo_id)");
|
||||
}
|
||||
sql.append(" WHERE ");
|
||||
sql.append(" t.activo=1 ");
|
||||
if (moneda != null) {
|
||||
sql.append(" and t.moneda_id=" + moneda.getMonedaId());
|
||||
}
|
||||
if (marca != null) {
|
||||
sql.append(" and t.marca_id=" + marca.getMarcaId());
|
||||
} else {
|
||||
String stringMarca =" and t.marca_id in (";
|
||||
int contador =0;
|
||||
for(Marca m:lsMarcas){
|
||||
if(contador==0){
|
||||
stringMarca=stringMarca+m.getMarcaId().toString();
|
||||
}else{
|
||||
stringMarca=stringMarca+","+m.getMarcaId();
|
||||
}
|
||||
contador++;
|
||||
if(lsMarcas.size()==contador){
|
||||
stringMarca=stringMarca+")";
|
||||
}
|
||||
}
|
||||
sql.append(stringMarca);
|
||||
|
||||
}
|
||||
if (ruta != null) {
|
||||
sql.append(" and t.ruta_id=" + ruta.getRutaId());
|
||||
}
|
||||
if (numRuta != null) {
|
||||
sql.append(" and r.numruta=" + numRuta);
|
||||
}
|
||||
if (origem != null) {
|
||||
sql.append(" and origem.parada_id=" + origem.getParadaId());
|
||||
}
|
||||
if (destino != null) {
|
||||
sql.append(" and destino.parada_id=" + destino.getParadaId());
|
||||
}
|
||||
if (claseServicio != null) {
|
||||
sql.append(" and t.claseservicio_id=" + claseServicio.getClaseservicioId());
|
||||
}
|
||||
|
||||
if (vende != null) {
|
||||
int simNao = vende ? 1 : 0;
|
||||
sql.append(" and rc.tramo_id=t.tramo_id and rc.ruta_id=t.ruta_id and rc.activo=1 and rc.INDVENTA=" + simNao);
|
||||
}
|
||||
|
||||
Query qr = getSession().createSQLQuery(sql.toString()).addScalar("tarifaoficialid", Hibernate.INTEGER).addScalar("precio", Hibernate.BIG_DECIMAL).addScalar("preciooriginal", Hibernate.BIG_DECIMAL).addScalar("importepedagio", Hibernate.BIG_DECIMAL).addScalar("importetaxaembarque", Hibernate.BIG_DECIMAL).addScalar("importeseguro", Hibernate.BIG_DECIMAL).addScalar("importetpp", Hibernate.BIG_DECIMAL).addScalar("importeoutros", Hibernate.BIG_DECIMAL).addScalar("descparadaorigem", Hibernate.STRING).addScalar("descparadadestino", Hibernate.STRING).addScalar("nomevia", Hibernate.STRING).addScalar("descmarca", Hibernate.STRING).addScalar("descclasse", Hibernate.STRING).addScalar("descorgao", Hibernate.STRING).addScalar("rutaprefixo", Hibernate.STRING).addScalar("numruta", Hibernate.STRING).setResultTransformer(Transformers.aliasToBean(TarifaOficialVO.class));
|
||||
|
||||
return (List<TarifaOficialVO>) qr.list();
|
||||
}
|
||||
}
|
|
@ -9,6 +9,7 @@ import java.math.BigDecimal;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import javax.persistence.Basic;
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Column;
|
||||
|
|
|
@ -4,8 +4,12 @@ import java.util.List;
|
|||
|
||||
import com.rjconsultores.ventaboletos.constantes.TipoSeguro;
|
||||
import com.rjconsultores.ventaboletos.dao.TarifaOficialDAO;
|
||||
import com.rjconsultores.ventaboletos.entidad.ClaseServicio;
|
||||
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||
import com.rjconsultores.ventaboletos.entidad.Marca;
|
||||
import com.rjconsultores.ventaboletos.entidad.Moneda;
|
||||
import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente;
|
||||
import com.rjconsultores.ventaboletos.entidad.Parada;
|
||||
import com.rjconsultores.ventaboletos.entidad.Ruta;
|
||||
import com.rjconsultores.ventaboletos.entidad.TarifaOficial;
|
||||
import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa;
|
||||
|
@ -143,4 +147,7 @@ public interface TarifaOficialService {
|
|||
|
||||
public long obtenerCount(List<Empresa> lsEmpresaSelected);
|
||||
|
||||
public List<TarifaOficial> obterTarifaOficialPorFiltro(Moneda moneda, Marca marca,List<Marca> lsMarcas,Parada origem, Parada destino, ClaseServicio claseServicio, Ruta ruta, String numRuta, Boolean vende);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -65,5 +65,7 @@ public interface TarifaService extends GenericService<Tarifa, Integer> {
|
|||
|
||||
public void excluirTodasTarifas(Moneda moneda, Marca marca, ClaseServicio claseServicio, VigenciaTarifa vigenciaTarifa, Parada origem,
|
||||
Parada destino, Categoria categoria, TipoPuntoVenta tipoPuntoVenta, Ruta ruta, Via via);
|
||||
|
||||
public List<Tarifa> obterTarifaOficialPorFiltro(Moneda moneda, Marca marca,List<Marca>lsMarcas, Parada origem, Parada destino, ClaseServicio claseServicio,VigenciaTarifa vigenciaTarifa, Categoria categoria,TipoPuntoVenta tipoPuntoVenta, Ruta ruta, Via via,Boolean vende);
|
||||
|
||||
}
|
||||
|
|
|
@ -14,14 +14,21 @@ import com.rjconsultores.ventaboletos.dao.OrgaoConcedenteDAO;
|
|||
import com.rjconsultores.ventaboletos.dao.SeguroKmDAO;
|
||||
import com.rjconsultores.ventaboletos.dao.SeguroTarifaDAO;
|
||||
import com.rjconsultores.ventaboletos.dao.TarifaOficialDAO;
|
||||
import com.rjconsultores.ventaboletos.entidad.ClaseServicio;
|
||||
import com.rjconsultores.ventaboletos.entidad.Empresa;
|
||||
import com.rjconsultores.ventaboletos.entidad.Marca;
|
||||
import com.rjconsultores.ventaboletos.entidad.Moneda;
|
||||
import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente;
|
||||
import com.rjconsultores.ventaboletos.entidad.Parada;
|
||||
import com.rjconsultores.ventaboletos.entidad.Ruta;
|
||||
import com.rjconsultores.ventaboletos.entidad.TarifaOficial;
|
||||
import com.rjconsultores.ventaboletos.entidad.Tramo;
|
||||
import com.rjconsultores.ventaboletos.entidad.Via;
|
||||
import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa;
|
||||
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
||||
import com.rjconsultores.ventaboletos.service.TarifaOficialService;
|
||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||
import com.rjconsultores.ventaboletos.vo.comissao.TarifaOficialVO;
|
||||
|
||||
@Service("tarifaOficialService")
|
||||
public class TarifaOficialServiceImpl implements TarifaOficialService {
|
||||
|
@ -263,4 +270,57 @@ public class TarifaOficialServiceImpl implements TarifaOficialService {
|
|||
tarifaOficialDAO.atualizarPedagio();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TarifaOficial> obterTarifaOficialPorFiltro(Moneda moneda, Marca marca,List<Marca> lsMarcas,Parada origem, Parada destino, ClaseServicio claseServicio, Ruta ruta, String numRuta, Boolean vende){
|
||||
return converterVo(tarifaOficialDAO.obterTarifaOficialPorFiltroVO(moneda, marca, lsMarcas, origem, destino, claseServicio, ruta, numRuta, vende));
|
||||
}
|
||||
public List<TarifaOficial> converterVo(List<TarifaOficialVO> lsTarifaOficialVo){
|
||||
List<TarifaOficial> lsTarifa= new ArrayList<TarifaOficial>();
|
||||
TarifaOficial ta;
|
||||
Parada origem;
|
||||
Parada destino;
|
||||
Tramo tramo;
|
||||
Marca marca;
|
||||
Via via;
|
||||
|
||||
for(TarifaOficialVO t:lsTarifaOficialVo){
|
||||
ta= new TarifaOficial();
|
||||
ta.setTarifaOficialId(t.getTarifaoficialid());
|
||||
ta.setPrecio(t.getPrecio());
|
||||
ta.setPreciooriginal(t.getPreciooriginal());
|
||||
ta.setImportepedagio(t.getImportepedagio());
|
||||
ta.setImporteseguro(t.getImporteseguro());
|
||||
ta.setImportetaxaembarque(t.getImportetaxaembarque());
|
||||
ta.setImporteoutros(t.getImporteoutros());
|
||||
ta.setImportetpp(t.getImportetpp());
|
||||
origem = new Parada();
|
||||
origem.setDescparada(t.getDescparadaorigem());
|
||||
destino = new Parada();
|
||||
destino.setDescparada(t.getDescparadadestino());
|
||||
via =new Via();
|
||||
via.setNombvia(t.getNomevia());
|
||||
tramo = new Tramo();
|
||||
tramo.setOrigem(origem);
|
||||
tramo.setDestino(destino);
|
||||
tramo.setVia(via);
|
||||
ta.setTramo(tramo);
|
||||
marca= new Marca();
|
||||
marca.setDescmarca(t.getDescmarca());
|
||||
ta.setMarca(marca);
|
||||
OrgaoConcedente or = new OrgaoConcedente();
|
||||
or.setDescOrgao(t.getDescorgao());
|
||||
ta.setOrgaoConcedente(or);
|
||||
ClaseServicio cl = new ClaseServicio();
|
||||
cl.setDescclase(t.getDescclasse());
|
||||
ta.setClaseServicio(cl);
|
||||
Ruta r = new Ruta();
|
||||
r.setPrefixo(t.getRutaprefixo());
|
||||
r.setNumRuta(t.getNumruta());
|
||||
ta.setRuta(r);
|
||||
lsTarifa.add(ta);
|
||||
|
||||
}
|
||||
return lsTarifa;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ package com.rjconsultores.ventaboletos.service.impl;
|
|||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -41,6 +42,7 @@ import com.rjconsultores.ventaboletos.service.TarifaHistService;
|
|||
import com.rjconsultores.ventaboletos.service.TarifaMinimaService;
|
||||
import com.rjconsultores.ventaboletos.service.TarifaService;
|
||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||
import com.rjconsultores.ventaboletos.vo.comissao.TarifaVO;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -281,4 +283,65 @@ public class TarifaServiceImpl implements TarifaService {
|
|||
Parada destino, Categoria categoria, TipoPuntoVenta tipoPuntoVenta, Ruta ruta, Via via){
|
||||
tarifaDAO.excluirTodasTarifas(moneda, marca, claseServicio, vigenciaTarifa, origem, destino, categoria, tipoPuntoVenta, ruta, via);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Tarifa> obterTarifaOficialPorFiltro(Moneda moneda, Marca marca, List<Marca> lsMarcas, Parada origem, Parada destino, ClaseServicio claseServicio, VigenciaTarifa vigenciaTarifa, Categoria categoria, TipoPuntoVenta tipoPuntoVenta, Ruta ruta, Via via, Boolean vende) {
|
||||
return converterVo(tarifaDAO.obterTarifaOficialPorFiltroVO(moneda, marca, lsMarcas, origem, destino, claseServicio, vigenciaTarifa, categoria, tipoPuntoVenta, ruta, via, vende));
|
||||
|
||||
}
|
||||
|
||||
public List<Tarifa> converterVo(List<TarifaVO> lsTarifaVo){
|
||||
List<Tarifa> lsTarifa= new ArrayList<Tarifa>();
|
||||
Tarifa ta;
|
||||
Parada origem;
|
||||
Parada destino;
|
||||
Tramo tramo;
|
||||
Marca marca;
|
||||
Via via;
|
||||
VigenciaTarifa vi;
|
||||
|
||||
for(TarifaVO t:lsTarifaVo){
|
||||
ta= new Tarifa();
|
||||
ta.setTarifaId(t.getTarifaid());
|
||||
ta.setPrecio(t.getPrecio());
|
||||
ta.setPreciooriginal(t.getPreciooriginal());
|
||||
ta.setImportepedagio(t.getImportepedagio());
|
||||
ta.setImporteseguro(t.getImporteseguro());
|
||||
ta.setImportetaxaembarque(t.getImportetaxaembarque());
|
||||
ta.setImporteoutros(t.getImporteoutros());
|
||||
ta.setImporteTPP(t.getImportetpp());
|
||||
origem = new Parada();
|
||||
origem.setDescparada(t.getDescparadaOrigem());
|
||||
destino = new Parada();
|
||||
destino.setDescparada(t.getDescparadaDestino());
|
||||
via =new Via();
|
||||
via.setNombvia(t.getNomeVia());
|
||||
tramo = new Tramo();
|
||||
tramo.setOrigem(origem);
|
||||
tramo.setDestino(destino);
|
||||
tramo.setVia(via);
|
||||
ta.setTramo(tramo);
|
||||
marca= new Marca();
|
||||
marca.setDescmarca(t.getDescMarca());
|
||||
ta.setMarca(marca);
|
||||
vi= new VigenciaTarifa();
|
||||
vi.setFeciniciovigencia(t.getFeciniciovigencia());
|
||||
vi.setFecfinvigencia(t.getFecfimvigencia());
|
||||
ta.setVigenciaTarifa(vi);
|
||||
OrgaoConcedente or = new OrgaoConcedente();
|
||||
or.setDescOrgao(t.getDescorgao());
|
||||
ta.setOrgaoConcedente(or);
|
||||
ClaseServicio cl = new ClaseServicio();
|
||||
cl.setDescclase(t.getDescclasse());
|
||||
ta.setClaseServicio(cl);
|
||||
Ruta r = new Ruta();
|
||||
r.setPrefixo(t.getRutaprefixo());
|
||||
r.setNumRuta(t.getNumruta());
|
||||
ta.setRuta(r);
|
||||
lsTarifa.add(ta);
|
||||
|
||||
|
||||
}
|
||||
return lsTarifa;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,124 @@
|
|||
package com.rjconsultores.ventaboletos.vo.comissao;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
public class TarifaOficialVO {
|
||||
|
||||
private Integer tarifaoficialid;
|
||||
private BigDecimal precio;
|
||||
private BigDecimal preciooriginal;
|
||||
private BigDecimal importepedagio;
|
||||
private BigDecimal importetaxaembarque;
|
||||
private BigDecimal importeseguro;
|
||||
private BigDecimal importetpp;
|
||||
private BigDecimal importeoutros;
|
||||
private String descparadaorigem;
|
||||
private String descparadadestino;
|
||||
private String nomevia;
|
||||
private String descmarca;
|
||||
private String descorgao;
|
||||
private String rutaprefixo;
|
||||
private String numruta;
|
||||
private String descclasse;
|
||||
|
||||
|
||||
public Integer getTarifaoficialid() {
|
||||
return tarifaoficialid;
|
||||
}
|
||||
public void setTarifaoficialid(Integer tarifaoficialid) {
|
||||
this.tarifaoficialid = tarifaoficialid;
|
||||
}
|
||||
public BigDecimal getPrecio() {
|
||||
return precio;
|
||||
}
|
||||
public void setPrecio(BigDecimal precio) {
|
||||
this.precio = precio;
|
||||
}
|
||||
public BigDecimal getPreciooriginal() {
|
||||
return preciooriginal;
|
||||
}
|
||||
public void setPreciooriginal(BigDecimal preciooriginal) {
|
||||
this.preciooriginal = preciooriginal;
|
||||
}
|
||||
public BigDecimal getImportepedagio() {
|
||||
return importepedagio;
|
||||
}
|
||||
public void setImportepedagio(BigDecimal importepedagio) {
|
||||
this.importepedagio = importepedagio;
|
||||
}
|
||||
public BigDecimal getImportetaxaembarque() {
|
||||
return importetaxaembarque;
|
||||
}
|
||||
public void setImportetaxaembarque(BigDecimal importetaxaembarque) {
|
||||
this.importetaxaembarque = importetaxaembarque;
|
||||
}
|
||||
public BigDecimal getImporteseguro() {
|
||||
return importeseguro;
|
||||
}
|
||||
public void setImporteseguro(BigDecimal importeseguro) {
|
||||
this.importeseguro = importeseguro;
|
||||
}
|
||||
public BigDecimal getImportetpp() {
|
||||
return importetpp;
|
||||
}
|
||||
public void setImportetpp(BigDecimal importetpp) {
|
||||
this.importetpp = importetpp;
|
||||
}
|
||||
public BigDecimal getImporteoutros() {
|
||||
return importeoutros;
|
||||
}
|
||||
public void setImporteoutros(BigDecimal importeoutros) {
|
||||
this.importeoutros = importeoutros;
|
||||
}
|
||||
public String getDescparadaorigem() {
|
||||
return descparadaorigem;
|
||||
}
|
||||
public void setDescparadaorigem(String descparadaorigem) {
|
||||
this.descparadaorigem = descparadaorigem;
|
||||
}
|
||||
public String getDescparadadestino() {
|
||||
return descparadadestino;
|
||||
}
|
||||
public void setDescparadadestino(String descparadadestino) {
|
||||
this.descparadadestino = descparadadestino;
|
||||
}
|
||||
public String getNomevia() {
|
||||
return nomevia;
|
||||
}
|
||||
public void setNomevia(String nomevia) {
|
||||
this.nomevia = nomevia;
|
||||
}
|
||||
public String getDescmarca() {
|
||||
return descmarca;
|
||||
}
|
||||
public void setDescmarca(String descmarca) {
|
||||
this.descmarca = descmarca;
|
||||
}
|
||||
public String getDescorgao() {
|
||||
return descorgao;
|
||||
}
|
||||
public void setDescorgao(String descorgao) {
|
||||
this.descorgao = descorgao;
|
||||
}
|
||||
public String getRutaprefixo() {
|
||||
return rutaprefixo;
|
||||
}
|
||||
public void setRutaprefixo(String rutaprefixo) {
|
||||
this.rutaprefixo = rutaprefixo;
|
||||
}
|
||||
public String getNumruta() {
|
||||
return numruta;
|
||||
}
|
||||
public void setNumruta(String numruta) {
|
||||
this.numruta = numruta;
|
||||
}
|
||||
public String getDescclasse() {
|
||||
return descclasse;
|
||||
}
|
||||
public void setDescclasse(String descclasse) {
|
||||
this.descclasse = descclasse;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,143 @@
|
|||
package com.rjconsultores.ventaboletos.vo.comissao;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
public class TarifaVO {
|
||||
|
||||
|
||||
|
||||
private Integer tarifaid;
|
||||
private BigDecimal precio;
|
||||
private BigDecimal preciooriginal;
|
||||
private BigDecimal importepedagio;
|
||||
private BigDecimal importetaxaembarque;
|
||||
private BigDecimal importeseguro;
|
||||
private BigDecimal importetpp;
|
||||
private BigDecimal importeoutros;
|
||||
private String statustarifa;
|
||||
private String descparadaOrigem;
|
||||
private String descparadaDestino;
|
||||
private String nomeVia;
|
||||
private String descMarca;
|
||||
private java.util.Date feciniciovigencia;
|
||||
private java.util.Date fecfimvigencia;
|
||||
private String descorgao;
|
||||
private String rutaprefixo;
|
||||
private String numruta;
|
||||
private String descclasse;
|
||||
public Integer getTarifaid() {
|
||||
return tarifaid;
|
||||
}
|
||||
public void setTarifaid(Integer tarifaid) {
|
||||
this.tarifaid = tarifaid;
|
||||
}
|
||||
public BigDecimal getPrecio() {
|
||||
return precio;
|
||||
}
|
||||
public void setPrecio(BigDecimal precio) {
|
||||
this.precio = precio;
|
||||
}
|
||||
public BigDecimal getPreciooriginal() {
|
||||
return preciooriginal;
|
||||
}
|
||||
public void setPreciooriginal(BigDecimal preciooriginal) {
|
||||
this.preciooriginal = preciooriginal;
|
||||
}
|
||||
public BigDecimal getImportepedagio() {
|
||||
return importepedagio;
|
||||
}
|
||||
public void setImportepedagio(BigDecimal importepedagio) {
|
||||
this.importepedagio = importepedagio;
|
||||
}
|
||||
public BigDecimal getImportetaxaembarque() {
|
||||
return importetaxaembarque;
|
||||
}
|
||||
public void setImportetaxaembarque(BigDecimal importetaxaembarque) {
|
||||
this.importetaxaembarque = importetaxaembarque;
|
||||
}
|
||||
public BigDecimal getImporteseguro() {
|
||||
return importeseguro;
|
||||
}
|
||||
public void setImporteseguro(BigDecimal importeseguro) {
|
||||
this.importeseguro = importeseguro;
|
||||
}
|
||||
public BigDecimal getImportetpp() {
|
||||
return importetpp;
|
||||
}
|
||||
public void setImportetpp(BigDecimal importetpp) {
|
||||
this.importetpp = importetpp;
|
||||
}
|
||||
public BigDecimal getImporteoutros() {
|
||||
return importeoutros;
|
||||
}
|
||||
public void setImporteoutros(BigDecimal importeoutros) {
|
||||
this.importeoutros = importeoutros;
|
||||
}
|
||||
public String getStatustarifa() {
|
||||
return statustarifa;
|
||||
}
|
||||
public void setStatustarifa(String statustarifa) {
|
||||
this.statustarifa = statustarifa;
|
||||
}
|
||||
public String getDescparadaOrigem() {
|
||||
return descparadaOrigem;
|
||||
}
|
||||
public void setDescparadaOrigem(String descparadaOrigem) {
|
||||
this.descparadaOrigem = descparadaOrigem;
|
||||
}
|
||||
public String getDescparadaDestino() {
|
||||
return descparadaDestino;
|
||||
}
|
||||
public void setDescparadaDestino(String descparadaDestino) {
|
||||
this.descparadaDestino = descparadaDestino;
|
||||
}
|
||||
public String getNomeVia() {
|
||||
return nomeVia;
|
||||
}
|
||||
public void setNomeVia(String nomeVia) {
|
||||
this.nomeVia = nomeVia;
|
||||
}
|
||||
public String getDescMarca() {
|
||||
return descMarca;
|
||||
}
|
||||
public void setDescMarca(String descMarca) {
|
||||
this.descMarca = descMarca;
|
||||
}
|
||||
public java.util.Date getFeciniciovigencia() {
|
||||
return feciniciovigencia;
|
||||
}
|
||||
public void setFeciniciovigencia(java.util.Date feciniciovigencia) {
|
||||
this.feciniciovigencia = feciniciovigencia;
|
||||
}
|
||||
public java.util.Date getFecfimvigencia() {
|
||||
return fecfimvigencia;
|
||||
}
|
||||
public void setFecfimvigencia(java.util.Date fecfimvigencia) {
|
||||
this.fecfimvigencia = fecfimvigencia;
|
||||
}
|
||||
public String getDescorgao() {
|
||||
return descorgao;
|
||||
}
|
||||
public void setDescorgao(String descorgao) {
|
||||
this.descorgao = descorgao;
|
||||
}
|
||||
public String getRutaprefixo() {
|
||||
return rutaprefixo;
|
||||
}
|
||||
public void setRutaprefixo(String rutaprefixo) {
|
||||
this.rutaprefixo = rutaprefixo;
|
||||
}
|
||||
public String getNumruta() {
|
||||
return numruta;
|
||||
}
|
||||
public void setNumruta(String numruta) {
|
||||
this.numruta = numruta;
|
||||
}
|
||||
public String getDescclasse() {
|
||||
return descclasse;
|
||||
}
|
||||
public void setDescclasse(String descclasse) {
|
||||
this.descclasse = descclasse;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue