frederico 2016-08-02 19:30:57 +00:00
parent ec59a79660
commit 01ac16b02f
8 changed files with 52 additions and 3 deletions

View File

@ -56,7 +56,8 @@ public interface RutaDAO extends GenericDAO<Ruta, Integer> {
public List<Ruta> buscaRutasFromOrgao(OrgaoConcedente orgao);
public List<Ruta> buscarPorRutaPorEmpresas(List<Empresa> lsEmpresas);
public List<Ruta> buscarRutasPorEmpresaOrgaoConcedente(Empresa empresa, OrgaoConcedente orgao);
}

View File

@ -7,6 +7,7 @@ package com.rjconsultores.ventaboletos.dao;
import java.util.List;
import com.rjconsultores.ventaboletos.entidad.Empresa;
import com.rjconsultores.ventaboletos.entidad.Ruta;
import com.rjconsultores.ventaboletos.entidad.RutaEmpresa;
/**
@ -16,4 +17,6 @@ import com.rjconsultores.ventaboletos.entidad.RutaEmpresa;
public interface RutaEmpresaDAO extends GenericDAO<RutaEmpresa, Integer> {
public List<RutaEmpresa> obtenerPorEmpresa(Empresa empresa);
public List<RutaEmpresa> obtenerPorRuta(Ruta ruta);
}

View File

@ -16,6 +16,7 @@ import org.springframework.stereotype.Repository;
import com.rjconsultores.ventaboletos.dao.RutaEmpresaDAO;
import com.rjconsultores.ventaboletos.entidad.Empresa;
import com.rjconsultores.ventaboletos.entidad.Ruta;
import com.rjconsultores.ventaboletos.entidad.RutaEmpresa;
/**
@ -40,4 +41,12 @@ public class RutaEmpresaHibernateDAO extends GenericHibernateDAO<RutaEmpresa, In
return qry.list();
}
public List<RutaEmpresa> obtenerPorRuta(Ruta ruta) {
Criteria c = getSession().createCriteria(getPersistentClass());
c.add(Restrictions.eq("activo", Boolean.TRUE));
c.add(Restrictions.eq("ruta", ruta));
return c.list();
}
}

View File

@ -206,4 +206,23 @@ public class RutaHibernateDAO extends GenericHibernateDAO<Ruta, Integer> impleme
return lsRuta;
}
@Override
public List<Ruta> buscarRutasPorEmpresaOrgaoConcedente(Empresa empresa, OrgaoConcedente orgao) {
Criteria c = getSession().createCriteria(getPersistentClass());
c.add(Restrictions.eq("activo", Boolean.TRUE));
c.add(Restrictions.ne("rutaId", -1));
if (empresa != null && empresa.getEmpresaId() != -1) {
c.createCriteria("lsRutaEmpresa").add(Restrictions.eq("empresa", empresa));
}
if (orgao != null && orgao.getOrgaoConcedenteId() != -1) {
c.add(Restrictions.eq("orgaoConcedente", orgao));
}
c.addOrder(Order.asc("descruta"));
return c.list();
}
}

View File

@ -7,6 +7,7 @@ package com.rjconsultores.ventaboletos.service;
import java.util.List;
import com.rjconsultores.ventaboletos.entidad.Empresa;
import com.rjconsultores.ventaboletos.entidad.Ruta;
import com.rjconsultores.ventaboletos.entidad.RutaEmpresa;
/**
@ -16,4 +17,6 @@ import com.rjconsultores.ventaboletos.entidad.RutaEmpresa;
public interface RutaEmpresaService extends GenericService<RutaEmpresa, Integer> {
public List<RutaEmpresa> obtenerPorEmpresa(Empresa empresa);
public List<RutaEmpresa> obtenerPorRuta(Ruta ruta);
}

View File

@ -104,4 +104,6 @@ public interface RutaService {
*/
public List<ParadaSecuenciaCombinacaoLinha> verificarSeqRutaNaoGerada(Ruta ruta, List<ParadaSecuencia> lsParadasSequencia);
public List<Ruta> buscarRutasPorEmpresaOrgaoConcedente(Empresa empresa, OrgaoConcedente orgao);
}

View File

@ -6,6 +6,7 @@ package com.rjconsultores.ventaboletos.service.impl;
import com.rjconsultores.ventaboletos.dao.RutaEmpresaDAO;
import com.rjconsultores.ventaboletos.entidad.Empresa;
import com.rjconsultores.ventaboletos.entidad.Ruta;
import com.rjconsultores.ventaboletos.entidad.RutaEmpresa;
import com.rjconsultores.ventaboletos.service.RutaEmpresaService;
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
@ -66,4 +67,10 @@ public class RutaEmpresaServiceImpl implements RutaEmpresaService {
public List<RutaEmpresa> obtenerPorEmpresa(Empresa empresa) {
return rutaEmpresaDAO.obtenerPorEmpresa(empresa);
}
@Override
public List<RutaEmpresa> obtenerPorRuta(Ruta ruta) {
return rutaEmpresaDAO.obtenerPorRuta(ruta);
}
}

View File

@ -405,4 +405,9 @@ public class RutaServiceImpl implements RutaService {
return sequencias;
}
@Override
public List<Ruta> buscarRutasPorEmpresaOrgaoConcedente(Empresa empresa, OrgaoConcedente orgao) {
return rutaDAO.buscarRutasPorEmpresaOrgaoConcedente(empresa, orgao);
}
}