From 7557b965faa6281914d83518d6aedb622e402f61 Mon Sep 17 00:00:00 2001 From: vinicius Date: Tue, 26 Nov 2013 15:30:13 +0000 Subject: [PATCH] git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@32261 d1611594-4594-4d17-8e1d-87c2c4800839 --- .../ventaboletos/dao/AbastoCentralDAO.java | 28 ++ .../ventaboletos/dao/AbastoHistoDAO.java | 13 + .../ventaboletos/dao/AidfDAO.java | 12 + .../ventaboletos/dao/AidfEspecieDAO.java | 7 + .../ventaboletos/dao/AidfTipoDAO.java | 7 + .../ventaboletos/dao/EstacionDAO.java | 6 + .../dao/PtovtaTipoEstoqueDAO.java | 11 + .../ventaboletos/dao/PuntoVentaDAO.java | 8 + .../dao/TipoMovimentacionDAO.java | 12 + .../ventaboletos/dao/UsuarioUbicacionDAO.java | 5 +- .../hibernate/AbastoCentralHibernateDAO.java | 165 ++++++++ .../hibernate/AbastoHistoHibernateDAO.java | 59 +++ .../hibernate/AidfEspecieHibernateDAO.java | 32 ++ .../dao/hibernate/AidfHibernateDAO.java | 42 ++ .../dao/hibernate/AidfTipoHibernateDAO.java | 32 ++ .../dao/hibernate/EstacionHibernateDAO.java | 26 ++ .../PtovtaTipoEstoqueHibernateDAO.java | 47 +++ .../dao/hibernate/PuntoVentaHibernateDAO.java | 97 ++++- .../TipoMovimentacionHibernateDAO.java | 55 +++ .../UsuarioUbicacionHibernateDAO.java | 15 + .../ventaboletos/entidad/AbastoCentral.java | 150 +++++++ .../ventaboletos/entidad/AbastoHisto.java | 189 +++++++++ .../ventaboletos/entidad/Aidf.java | 259 ++++++++++++ .../ventaboletos/entidad/AidfEspecie.java | 113 +++++ .../ventaboletos/entidad/AidfTipo.java | 113 +++++ .../ventaboletos/entidad/Estacion.java | 2 +- .../entidad/PtovtaTipoEstoque.java | 117 ++++++ .../ventaboletos/entidad/PuntoVenta.java | 12 + .../entidad/TipoMovimentacion.java | 124 ++++++ .../service/AbastoCentralService.java | 12 + .../service/AbastoHistoService.java | 11 + .../ventaboletos/service/AidfService.java | 16 + .../ventaboletos/service/EstacionService.java | 3 + .../service/MovimentacionBilhetesService.java | 33 ++ .../service/PuntoVentaService.java | 9 +- .../impl/AbastoCentralServiceImpl.java | 56 +++ .../service/impl/AbastoHistoServiceImpl.java | 49 +++ .../service/impl/AidfServiceImpl.java | 90 ++++ .../service/impl/EstacionServiceImpl.java | 8 + .../MovimentacionBilhetesServiceImpl.java | 196 +++++++++ .../service/impl/PuntoVentaServiceImpl.java | 19 +- .../service/impl/UsuarioServiceImpl.java | 4 +- src/hibernate.cfg.xml | 392 +++++++++--------- src/hibernate.reveng.xml | 47 +++ 44 files changed, 2500 insertions(+), 203 deletions(-) create mode 100644 src/com/rjconsultores/ventaboletos/dao/AbastoCentralDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/AbastoHistoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/AidfDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/AidfEspecieDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/AidfTipoDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/PtovtaTipoEstoqueDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/TipoMovimentacionDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/AbastoCentralHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/AbastoHistoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/AidfEspecieHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/AidfHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/AidfTipoHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaTipoEstoqueHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/TipoMovimentacionHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/AbastoCentral.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/AbastoHisto.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/Aidf.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/AidfEspecie.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/AidfTipo.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/PtovtaTipoEstoque.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/TipoMovimentacion.java create mode 100644 src/com/rjconsultores/ventaboletos/service/AbastoCentralService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/AbastoHistoService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/AidfService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/MovimentacionBilhetesService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/AbastoCentralServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/AbastoHistoServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/AidfServiceImpl.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/MovimentacionBilhetesServiceImpl.java create mode 100644 src/hibernate.reveng.xml diff --git a/src/com/rjconsultores/ventaboletos/dao/AbastoCentralDAO.java b/src/com/rjconsultores/ventaboletos/dao/AbastoCentralDAO.java new file mode 100644 index 000000000..7bd6ee0b0 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/AbastoCentralDAO.java @@ -0,0 +1,28 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.AbastoCentral; +import com.rjconsultores.ventaboletos.entidad.Aidf; +import com.rjconsultores.ventaboletos.entidad.Estacion; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; + +public interface AbastoCentralDAO extends GenericDAO { + + + public List obtenerBilhetes(Aidf aidf, PuntoVenta origem); + public List obtenerBilhetes(Aidf aidf, String formInicial, String formFinal, PuntoVenta origem); + + public List obtenerBilhetesPorPuntoVenta(PuntoVenta puntoVentaBilhetes); + public List obtenerBilhetesPorPuntoVenta(PuntoVenta puntoVentaBilhetes, Estacion origem); + public List obtenerBilhetesPorPuntoVenta(String formInicial, String formFinal, PuntoVenta puntoVentaBilhetes); + public List obtenerBilhetesPorPuntoVenta(String formInicial, String formFinal, PuntoVenta puntoVentaBilhetes, Estacion origem); + + public void actualizaBilhetes(List bilhetes, PuntoVenta destino); + public void actualizaBilhetes(List bilhetes, Estacion destino); + public void suscribirBilhetes(List bilhetes); + public List buscaBilhetesPorAidf(Aidf aidf); + + + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/AbastoHistoDAO.java b/src/com/rjconsultores/ventaboletos/dao/AbastoHistoDAO.java new file mode 100644 index 000000000..727d6af59 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/AbastoHistoDAO.java @@ -0,0 +1,13 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.AbastoCentral; +import com.rjconsultores.ventaboletos.entidad.AbastoHisto; +import com.rjconsultores.ventaboletos.entidad.TipoMovimentacion; + +public interface AbastoHistoDAO extends GenericDAO { + + public void grabaHistoricoBilhetes(List bilhetes, TipoMovimentacion tipoMovimentacion); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/AidfDAO.java b/src/com/rjconsultores/ventaboletos/dao/AidfDAO.java new file mode 100644 index 000000000..6602d75e1 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/AidfDAO.java @@ -0,0 +1,12 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Aidf; +import com.rjconsultores.ventaboletos.entidad.Empresa; + +public interface AidfDAO extends GenericDAO { + + public List buscaAidfsPorEmpresas(List empresas); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/AidfEspecieDAO.java b/src/com/rjconsultores/ventaboletos/dao/AidfEspecieDAO.java new file mode 100644 index 000000000..7341d7e4c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/AidfEspecieDAO.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.AidfEspecie; + +public interface AidfEspecieDAO extends GenericDAO { + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/AidfTipoDAO.java b/src/com/rjconsultores/ventaboletos/dao/AidfTipoDAO.java new file mode 100644 index 000000000..2bfd527ac --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/AidfTipoDAO.java @@ -0,0 +1,7 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.AidfTipo; + +public interface AidfTipoDAO extends GenericDAO { + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/EstacionDAO.java b/src/com/rjconsultores/ventaboletos/dao/EstacionDAO.java index 93f3f8b01..c5123d1a7 100644 --- a/src/com/rjconsultores/ventaboletos/dao/EstacionDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/EstacionDAO.java @@ -6,6 +6,8 @@ package com.rjconsultores.ventaboletos.dao; import com.rjconsultores.ventaboletos.entidad.Estacion; import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.entidad.Usuario; + import java.util.List; /** @@ -27,4 +29,8 @@ public interface EstacionDAO extends GenericDAO { * @return */ public List buscar(Long numCaja,PuntoVenta puntoVenta); + + public List buscarEstaciones(PuntoVenta puntoVenta); + + public List buscarPuntosVentaEstacionPorUsuario(Usuario usuario); } diff --git a/src/com/rjconsultores/ventaboletos/dao/PtovtaTipoEstoqueDAO.java b/src/com/rjconsultores/ventaboletos/dao/PtovtaTipoEstoqueDAO.java new file mode 100644 index 000000000..502e40a36 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/PtovtaTipoEstoqueDAO.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.PtovtaTipoEstoque; + +public interface PtovtaTipoEstoqueDAO extends GenericDAO { + + public PtovtaTipoEstoque buscarTipoSuprimento(); + public PtovtaTipoEstoque buscarTipoContabilidade(); + public PtovtaTipoEstoque buscarTipoNormal(); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/PuntoVentaDAO.java b/src/com/rjconsultores/ventaboletos/dao/PuntoVentaDAO.java index a43c99114..0beb60944 100644 --- a/src/com/rjconsultores/ventaboletos/dao/PuntoVentaDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/PuntoVentaDAO.java @@ -4,8 +4,12 @@ */ package com.rjconsultores.ventaboletos.dao; +import com.rjconsultores.ventaboletos.entidad.Empresa; import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.PtovtaTipoEstoque; import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.entidad.Usuario; + import java.util.List; /** @@ -23,4 +27,8 @@ public interface PuntoVentaDAO extends GenericDAO { public List buscaPuntoVentaParada(Parada parada); public List buscarPuntoVentaSubordinados(PuntoVenta puntoVenta); + + public List buscarPuntosVentaMovimentacionBilhetes(List empresas); + + public List buscarPuntoVentaPorTipoEstoque(PtovtaTipoEstoque tipoEstoque); } diff --git a/src/com/rjconsultores/ventaboletos/dao/TipoMovimentacionDAO.java b/src/com/rjconsultores/ventaboletos/dao/TipoMovimentacionDAO.java new file mode 100644 index 000000000..710a3d47a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/TipoMovimentacionDAO.java @@ -0,0 +1,12 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.TipoMovimentacion; + +public interface TipoMovimentacionDAO extends GenericDAO { + + public TipoMovimentacion buscarTipoMovimentacio(int tipoMovimentacion); + public List obtenerTiposMovimetacionPuntoVenta(); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/UsuarioUbicacionDAO.java b/src/com/rjconsultores/ventaboletos/dao/UsuarioUbicacionDAO.java index 513bffe63..69d259a1d 100644 --- a/src/com/rjconsultores/ventaboletos/dao/UsuarioUbicacionDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/UsuarioUbicacionDAO.java @@ -4,9 +4,11 @@ */ package com.rjconsultores.ventaboletos.dao; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; import com.rjconsultores.ventaboletos.entidad.Usuario; import com.rjconsultores.ventaboletos.entidad.UsuarioUbicacion; -import java.util.List; /** * @@ -15,4 +17,5 @@ import java.util.List; public interface UsuarioUbicacionDAO extends GenericDAO { public List buscarPorUsuario(Usuario usuario); + public List buscarPuntoVentaPorUsuario(Usuario usuario); } diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/AbastoCentralHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/AbastoCentralHibernateDAO.java new file mode 100644 index 000000000..027e2cd12 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/AbastoCentralHibernateDAO.java @@ -0,0 +1,165 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.AbastoCentralDAO; +import com.rjconsultores.ventaboletos.entidad.AbastoCentral; +import com.rjconsultores.ventaboletos.entidad.Aidf; +import com.rjconsultores.ventaboletos.entidad.Estacion; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; + +@Repository("abastoCentralDAO") +public class AbastoCentralHibernateDAO extends GenericHibernateDAO implements AbastoCentralDAO { + + @Autowired + public AbastoCentralHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return (List)c.list(); + } + + + public List obtenerBilhetes(Aidf aidf, PuntoVenta origem) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("aidf", aidf)); + c.add(Restrictions.eq("puntoventa", origem)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return (List)c.list(); + } + + + public List obtenerBilhetes(Aidf aidf, String formInicial, String formFinal, PuntoVenta origem) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("aidf", aidf)); + c.add(Restrictions.eq("puntoventa", origem)); + c.add(Restrictions.between("numfoliopreimpreso", formInicial, formFinal)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return (List)c.list(); + } + + @Transactional + public void actualizaBilhetes(List bilhetes, PuntoVenta destino) { + + Session session = getSessionFactory().getCurrentSession(); + + int count = 0; + + for(AbastoCentral bilhete : bilhetes){ + bilhete.setPuntoventa(destino); + session.update(bilhete); + + if(++count % 20 == 0){ + session.flush(); + session.clear(); + } + } + + session.flush(); + session.clear(); + } + + @Transactional + public void suscribirBilhetes(List bilhetes) { + Session session = getSessionFactory().getCurrentSession(); + + int count = 0; + + for(AbastoCentral bilhete : bilhetes){ + + session.save(bilhete); + + if(++count % 20 == 0){ + session.flush(); + session.clear(); + } + } + + session.flush(); + session.clear(); + } + + public List buscaBilhetesPorAidf(Aidf aidf) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("aidf", aidf)); + + return (List)c.list(); + } + + public List obtenerBilhetesPorPuntoVenta(PuntoVenta puntoVentaBilhetes) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("puntoventa", puntoVentaBilhetes)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return (List)c.list(); + } + + public List obtenerBilhetesPorPuntoVenta(String formInicial, String formFinal, PuntoVenta puntoVentaBilhetes) { + + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("puntoventa", puntoVentaBilhetes)); + c.add(Restrictions.between("numfoliopreimpreso", formInicial, formFinal)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return (List)c.list(); + } + + public List obtenerBilhetesPorPuntoVenta(PuntoVenta puntoVentaBilhetes, Estacion origem) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("puntoventa", puntoVentaBilhetes)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("estacion", origem)); + + return (List)c.list(); + } + + public List obtenerBilhetesPorPuntoVenta(String formInicial, String formFinal, PuntoVenta puntoVentaBilhetes, Estacion origem) { + + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("puntoventa", puntoVentaBilhetes)); + c.add(Restrictions.between("numfoliopreimpreso", formInicial, formFinal)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + if(origem != null) + c.add(Restrictions.eq("estacion", origem)); + + return (List)c.list(); + } + + @Transactional + public void actualizaBilhetes(List bilhetes, Estacion destino) { + + Session session = getSessionFactory().getCurrentSession(); + + int count = 0; + + for(AbastoCentral bilhete : bilhetes){ + bilhete.setEstacion(destino); + session.update(bilhete); + + if(++count % 20 == 0){ + session.flush(); + session.clear(); + } + } + + session.flush(); + session.clear(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/AbastoHistoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/AbastoHistoHibernateDAO.java new file mode 100644 index 000000000..4b24f455a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/AbastoHistoHibernateDAO.java @@ -0,0 +1,59 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Session; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.AbastoHistoDAO; +import com.rjconsultores.ventaboletos.entidad.AbastoCentral; +import com.rjconsultores.ventaboletos.entidad.AbastoHisto; +import com.rjconsultores.ventaboletos.entidad.TipoMovimentacion; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Repository("abastoHistoDAO") +public class AbastoHistoHibernateDAO extends GenericHibernateDAO implements AbastoHistoDAO { + + @Autowired + public AbastoHistoHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return (List)c.list(); + } + + public void grabaHistoricoBilhetes(List bilhetes, TipoMovimentacion tipoMovimentacion) { + Session session = getSessionFactory().getCurrentSession(); + + int count = 0; + + for(AbastoCentral bilhete : bilhetes){ + + Date dataActual = Calendar.getInstance().getTime(); + AbastoHisto nuevoHistorico = new AbastoHisto(bilhete, tipoMovimentacion, dataActual, true, dataActual, UsuarioLogado.getUsuarioLogado().getUsuarioId()); + + session.save(nuevoHistorico); + + if(++count % 20 == 0){ + session.flush(); + session.clear(); + } + } + + session.flush(); + session.clear(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/AidfEspecieHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/AidfEspecieHibernateDAO.java new file mode 100644 index 000000000..1e271125a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/AidfEspecieHibernateDAO.java @@ -0,0 +1,32 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.AidfEspecieDAO; +import com.rjconsultores.ventaboletos.entidad.AidfEspecie; + +@Repository("aidfEspecieDAO") +public class AidfEspecieHibernateDAO extends GenericHibernateDAO implements AidfEspecieDAO{ + + @Autowired + public AidfEspecieHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return (List)c.list(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/AidfHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/AidfHibernateDAO.java new file mode 100644 index 000000000..fd3871680 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/AidfHibernateDAO.java @@ -0,0 +1,42 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.AidfDAO; +import com.rjconsultores.ventaboletos.entidad.Aidf; +import com.rjconsultores.ventaboletos.entidad.Empresa; + +@Repository("aidfDAO") +public class AidfHibernateDAO extends GenericHibernateDAO implements AidfDAO{ + + @Autowired + public AidfHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return (List)c.list(); + } + + @Override + public List buscaAidfsPorEmpresas(List empresas) { + + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.in("empresa", empresas)); + + return (List)c.list(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/AidfTipoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/AidfTipoHibernateDAO.java new file mode 100644 index 000000000..4df4ad6f4 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/AidfTipoHibernateDAO.java @@ -0,0 +1,32 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.AidfTipoDAO; +import com.rjconsultores.ventaboletos.entidad.AidfTipo; + +@Repository("aidfTipoDAO") +public class AidfTipoHibernateDAO extends GenericHibernateDAO implements AidfTipoDAO { + + @Autowired + public AidfTipoHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return (List)c.list(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/EstacionHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/EstacionHibernateDAO.java index 446a0e303..f9aa3ed01 100644 --- a/src/com/rjconsultores/ventaboletos/dao/hibernate/EstacionHibernateDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/EstacionHibernateDAO.java @@ -7,10 +7,15 @@ package com.rjconsultores.ventaboletos.dao.hibernate; import com.rjconsultores.ventaboletos.dao.EstacionDAO; import com.rjconsultores.ventaboletos.entidad.Estacion; import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.entidad.Usuario; + import java.util.List; import org.hibernate.Criteria; import org.hibernate.SessionFactory; +import org.hibernate.criterion.DetachedCriteria; import org.hibernate.criterion.Order; +import org.hibernate.criterion.Projections; +import org.hibernate.criterion.Property; import org.hibernate.criterion.Restrictions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; @@ -66,4 +71,25 @@ public class EstacionHibernateDAO extends GenericHibernateDAO return c.list(); } + + public List buscarEstaciones(PuntoVenta puntoVenta) { + + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("puntoVenta", puntoVenta)); + c.addOrder(Order.asc("descestacion")); + c.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); + + return c.list(); + } + + @Override + public List buscarPuntosVentaEstacionPorUsuario(Usuario usuario) { + Criteria buscaPuntoVentasUsuario = getSession().createCriteria(getPersistentClass()) + .setProjection(Projections.distinct(Property.forName("puntoVenta"))) + .add(Restrictions.eq("activo", Boolean.TRUE)) + .add(Restrictions.eq("usuarioId", usuario.getUsuarioId())); + + return buscaPuntoVentasUsuario.list(); + } } diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaTipoEstoqueHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaTipoEstoqueHibernateDAO.java new file mode 100644 index 000000000..0c30b7253 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/PtovtaTipoEstoqueHibernateDAO.java @@ -0,0 +1,47 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.PtovtaTipoEstoqueDAO; +import com.rjconsultores.ventaboletos.entidad.PtovtaTipoEstoque; + +@Repository("ptovtaTipoEstoqueDAO") +public class PtovtaTipoEstoqueHibernateDAO extends GenericHibernateDAO implements PtovtaTipoEstoqueDAO { + + @Autowired + public PtovtaTipoEstoqueHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public PtovtaTipoEstoque buscarTipoSuprimento() { + PtovtaTipoEstoque tipo = buscarTipo(PtovtaTipoEstoque.TIPO_SUMINISTRO); + return tipo; + } + + @Override + public PtovtaTipoEstoque buscarTipoContabilidade() { + PtovtaTipoEstoque tipo = buscarTipo(PtovtaTipoEstoque.TIPO_CONTABILIDAD); + return tipo; + } + + @Override + public PtovtaTipoEstoque buscarTipoNormal() { + PtovtaTipoEstoque tipo = buscarTipo(PtovtaTipoEstoque.TIPO_NORMAL); + return tipo; + } + + private PtovtaTipoEstoque buscarTipo(int tipo) { + + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("ptovtatipoestId", tipo)); + + return (PtovtaTipoEstoque) c.uniqueResult(); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/PuntoVentaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/PuntoVentaHibernateDAO.java index 7e76df4f4..dc1c880bd 100644 --- a/src/com/rjconsultores/ventaboletos/dao/hibernate/PuntoVentaHibernateDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/PuntoVentaHibernateDAO.java @@ -4,19 +4,27 @@ */ package com.rjconsultores.ventaboletos.dao.hibernate; -import com.rjconsultores.ventaboletos.dao.PuntoVentaDAO; -import com.rjconsultores.ventaboletos.entidad.Parada; -import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import java.util.ArrayList; import java.util.List; -import org.hibernate.criterion.Order; + import org.hibernate.Criteria; import org.hibernate.SessionFactory; +import org.hibernate.criterion.Criterion; import org.hibernate.criterion.MatchMode; +import org.hibernate.criterion.Order; import org.hibernate.criterion.Restrictions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Repository; +import com.rjconsultores.ventaboletos.dao.PtovtaTipoEstoqueDAO; +import com.rjconsultores.ventaboletos.dao.PuntoVentaDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.entidad.Parada; +import com.rjconsultores.ventaboletos.entidad.PtovtaTipoEstoque; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.entidad.Usuario; + /** * * @author Administrador @@ -24,7 +32,11 @@ import org.springframework.stereotype.Repository; @Repository("puntoVentaDAO") public class PuntoVentaHibernateDAO extends GenericHibernateDAO implements PuntoVentaDAO { - + + @Autowired + private PtovtaTipoEstoqueDAO ptovtaTipoEstoqueDAO; + + @Autowired public PuntoVentaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { setSessionFactory(factory); @@ -83,4 +95,79 @@ public class PuntoVentaHibernateDAO extends GenericHibernateDAO buscarPuntosVentaMovimentacionBilhetes(List empresas) { + + Criteria c = getSession().createCriteria(getPersistentClass()); + + Criterion crtPtovta = + Restrictions.and(Restrictions.eq("activo", Boolean.TRUE), Restrictions.in("empresa", empresas)); + + PtovtaTipoEstoque supr = ptovtaTipoEstoqueDAO.buscarTipoSuprimento(); + PtovtaTipoEstoque cont = ptovtaTipoEstoqueDAO.buscarTipoContabilidade(); + + Criterion suprCont = Restrictions.in("ptovtaTipoEstoque", new PtovtaTipoEstoque[]{ supr, cont}); + + c.add(Restrictions.or(suprCont, crtPtovta)); + + c.addOrder(Order.asc("nombpuntoventa")); + List puntosVenta = c.list(); + +// List puntosVenta = geraListaDummy(); + + return puntosVenta; + } + + public List buscarPuntoVentaPorTipoEstoque(PtovtaTipoEstoque tipoEstoque) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("ptovtaTipoEstoque", tipoEstoque)); + + List puntosVenta = c.list(); + + return puntosVenta; + } + + private List geraListaDummy(){ + + Criteria c = getSession().createCriteria(getPersistentClass()); + + PtovtaTipoEstoque supr = ptovtaTipoEstoqueDAO.buscarTipoSuprimento(); + PtovtaTipoEstoque cont = ptovtaTipoEstoqueDAO.buscarTipoContabilidade(); + + Criterion suprCont = Restrictions.in("ptovtaTipoEstoque", new PtovtaTipoEstoque[]{ supr, cont}); + + Criterion crtPtovta = Restrictions.in("puntoventaId", new Integer[]{1,2,3,786,1321,1722}); + + c.add(Restrictions.or(suprCont, crtPtovta)); + List puntosVenta = c.list(); + +// PuntoVenta pv1 = new PuntoVenta(Integer.valueOf(1)); +// pv1.setNombpuntoventa("pv1"); +// +// PuntoVenta pv2 = new PuntoVenta(Integer.valueOf(2)); +// pv2.setNombpuntoventa("pv2"); +// +// PuntoVenta pv3 = new PuntoVenta(Integer.valueOf(3)); +// pv3.setNombpuntoventa("pv3"); +// +// PuntoVenta pv4 = new PuntoVenta(Integer.valueOf(786)); +// pv4.setNombpuntoventa("pv4"); +// +// PuntoVenta pv5 = new PuntoVenta(Integer.valueOf(1321)); +// pv5.setNombpuntoventa("pv5"); +// +// PuntoVenta pv6 = new PuntoVenta(Integer.valueOf(1722)); +// pv6.setNombpuntoventa("SUPRIMENTO"); +// +// List puntosVenta = new ArrayList(); +// puntosVenta.add(pv6); +// puntosVenta.add(pv1); +// puntosVenta.add(pv2); +// puntosVenta.add(pv3); +// puntosVenta.add(pv4); +// puntosVenta.add(pv5); + + return puntosVenta; + } } diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoMovimentacionHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoMovimentacionHibernateDAO.java new file mode 100644 index 000000000..5a11108c6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/TipoMovimentacionHibernateDAO.java @@ -0,0 +1,55 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.SessionFactory; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.TipoMovimentacionDAO; +import com.rjconsultores.ventaboletos.entidad.TipoMovimentacion; + +@Repository("tipoMovimentacionDAO") +public class TipoMovimentacionHibernateDAO extends GenericHibernateDAO implements TipoMovimentacionDAO { + + @Autowired + public TipoMovimentacionHibernateDAO( + @Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return (List)c.list(); + } + + @Override + public TipoMovimentacion buscarTipoMovimentacio(int tipoMovimentacion) { + + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("tipomovimentacionId", tipoMovimentacion)); + + return (TipoMovimentacion) c.uniqueResult(); + + } + + @Override + public List obtenerTiposMovimetacionPuntoVenta() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.in("tipomovimentacionId", new Integer[]{TipoMovimentacion.TIPO_ENVIO, TipoMovimentacion.TIPO_TRANSFERENCIA, TipoMovimentacion.TIPO_VOLVER})); + + return c.list(); + } + + + + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/UsuarioUbicacionHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/UsuarioUbicacionHibernateDAO.java index 17f0299b5..4d36b62ed 100644 --- a/src/com/rjconsultores/ventaboletos/dao/hibernate/UsuarioUbicacionHibernateDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/UsuarioUbicacionHibernateDAO.java @@ -5,11 +5,14 @@ package com.rjconsultores.ventaboletos.dao.hibernate; import com.rjconsultores.ventaboletos.dao.UsuarioUbicacionDAO; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; import com.rjconsultores.ventaboletos.entidad.Usuario; import com.rjconsultores.ventaboletos.entidad.UsuarioUbicacion; import java.util.List; import org.hibernate.Criteria; import org.hibernate.SessionFactory; +import org.hibernate.criterion.Order; +import org.hibernate.criterion.Property; import org.hibernate.criterion.Restrictions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; @@ -35,4 +38,16 @@ public class UsuarioUbicacionHibernateDAO extends GenericHibernateDAO buscarPuntoVentaPorUsuario(Usuario usuario) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("usuario", usuario)); + c.setProjection(Property.forName("puntoVenta")); + c.createAlias("puntoVenta", "ptovta"); + c.addOrder(Order.asc("ptovta.nombpuntoventa")); + + return c.list(); + } } diff --git a/src/com/rjconsultores/ventaboletos/entidad/AbastoCentral.java b/src/com/rjconsultores/ventaboletos/entidad/AbastoCentral.java new file mode 100644 index 000000000..3974ccf55 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/AbastoCentral.java @@ -0,0 +1,150 @@ +package com.rjconsultores.ventaboletos.entidad; + +// Generated 26/10/2013 14:51:58 by Hibernate Tools 3.4.0.CR1 + +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * AbastoCentral generated by hbm2java + */ +@Entity +@Table(name = "ABASTO_CENTRAL") +public class AbastoCentral implements java.io.Serializable { + + private Long abastocentralId; + private Aidf aidf; + private String numseriepreimpresa; + private String numfoliopreimpreso; + private String numsubseriepreimpreso; + private PuntoVenta puntoventa; + private Boolean activo; + private Date fecmodif; + private Integer usuarioId; + private Estacion estacion; + + public AbastoCentral() { + } + + public AbastoCentral(Aidf _aidf, String _numseriepreimpresa, String _numfoliopreimpreso, String _numsubseriepreimpreso, + PuntoVenta _puntoventa, Boolean _activo, Date _fecmodif, Integer _usuarioId) { + aidf = _aidf; + numseriepreimpresa = _numseriepreimpresa; + numfoliopreimpreso = _numfoliopreimpreso; + numsubseriepreimpreso = _numsubseriepreimpreso; + puntoventa = _puntoventa; + activo = _activo; + fecmodif = _fecmodif; + usuarioId = _usuarioId; + } + + @SequenceGenerator(name = "ABASTO_HISTO_SEQ", sequenceName = "ABASTO_HISTO_SEQ", allocationSize = 1) + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "ABASTO_HISTO_SEQ") + @Column(name = "ABASTOCENTRAL_ID", unique = true, nullable = false, precision = 15, scale = 0) + public Long getAbastocentralId() { + return this.abastocentralId; + } + + public void setAbastocentralId(Long abastocentralId) { + this.abastocentralId = abastocentralId; + } + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "AIDF_ID") + public Aidf getAidf() { + return this.aidf; + } + + public void setAidf(Aidf aidf) { + this.aidf = aidf; + } + + @Column(name = "NUMSERIEPREIMPRESA", length = 10) + public String getNumseriepreimpresa() { + return this.numseriepreimpresa; + } + + public void setNumseriepreimpresa(String numseriepreimpresa) { + this.numseriepreimpresa = numseriepreimpresa; + } + + @Column(name = "NUMFOLIOPREIMPRESO", length = 12) + public String getNumfoliopreimpreso() { + return this.numfoliopreimpreso; + } + + public void setNumfoliopreimpreso(String numfoliopreimpreso) { + this.numfoliopreimpreso = numfoliopreimpreso; + } + + @Column(name = "NUMSUBSERIEPREIMPRESO", length = 10) + public String getNumsubseriepreimpreso() { + return this.numsubseriepreimpreso; + } + + public void setNumsubseriepreimpreso(String numsubseriepreimpreso) { + this.numsubseriepreimpreso = numsubseriepreimpreso; + } + + @JoinColumn(name = "PUNTOVENTA_ID") + @ManyToOne + public PuntoVenta getPuntoventa() { + return this.puntoventa; + } + + public void setPuntoventa(PuntoVenta puntoventa) { + this.puntoventa = puntoventa; + } + + @Column(name = "ACTIVO", precision = 1, scale = 0) + public Boolean getActivo() { + return this.activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + @Temporal(TemporalType.DATE) + @Column(name = "FECMODIF", length = 7) + public Date getFecmodif() { + return this.fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + @Column(name = "USUARIO_ID", precision = 7, scale = 0) + public Integer getUsuarioId() { + return this.usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @ManyToOne + @JoinColumn(name = "ESTACION_ID") + public Estacion getEstacion() { + return estacion; + } + + public void setEstacion(Estacion estacion) { + this.estacion = estacion; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/AbastoHisto.java b/src/com/rjconsultores/ventaboletos/entidad/AbastoHisto.java new file mode 100644 index 000000000..27cb2f742 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/AbastoHisto.java @@ -0,0 +1,189 @@ +package com.rjconsultores.ventaboletos.entidad; + +// Generated 26/10/2013 14:51:58 by Hibernate Tools 3.4.0.CR1 + +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * AbastoHisto generated by hbm2java + */ +@Entity +@Table(name = "ABASTO_HISTO") +public class AbastoHisto implements java.io.Serializable { + + private Long abastohistoId; + private TipoMovimentacion tipoMovimentacion; + private Aidf aidf; + private String numseriepreimpresa; + private String numfoliopreimpreso; + private String numsubseriepreimpreso; + private Date fechorhisto; + private PuntoVenta puntoventa; + private Boolean activo; + private Date fecmodif; + private Integer usuarioId; + private Estacion estacion; + + public AbastoHisto() { + } + + public AbastoHisto(AbastoCentral bilhete, TipoMovimentacion _tipoMovimentacion, Date _fechorhisto, Boolean _activo, Date _fecmodif, Integer _usuarioId) { + tipoMovimentacion = _tipoMovimentacion; + aidf = bilhete.getAidf(); + numseriepreimpresa = bilhete.getNumseriepreimpresa(); + numfoliopreimpreso = bilhete.getNumfoliopreimpreso(); + numsubseriepreimpreso = bilhete.getNumsubseriepreimpreso(); + estacion = bilhete.getEstacion(); + fechorhisto = _fechorhisto; + puntoventa = bilhete.getPuntoventa(); + activo = _activo; + fecmodif = _fecmodif; + usuarioId = _usuarioId; + } + + public AbastoHisto(TipoMovimentacion _tipoMovimentacion, Aidf _aidf, String _numseriepreimpresa, String _numfoliopreimpreso, + String _numsubseriepreimpreso, Date _fechorhisto, PuntoVenta _puntoventa, Boolean _activo, Date _fecmodif, Integer _usuarioId, Estacion _estacion) { + tipoMovimentacion = _tipoMovimentacion; + aidf = _aidf; + numseriepreimpresa = _numseriepreimpresa; + numfoliopreimpreso = _numfoliopreimpreso; + numsubseriepreimpreso = _numsubseriepreimpreso; + fechorhisto = _fechorhisto; + puntoventa = _puntoventa; + activo = _activo; + fecmodif = _fecmodif; + usuarioId = _usuarioId; + estacion = _estacion; + } + + @SequenceGenerator(name = "ABASTO_HISTO_SEQ", sequenceName = "ABASTO_HISTO_SEQ", allocationSize = 1) + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "ABASTO_HISTO_SEQ") + @Column(name = "ABASTOHISTO_ID", unique = true, nullable = false, precision = 15, scale = 0) + public Long getAbastohistoId() { + return this.abastohistoId; + } + + public void setAbastohistoId(Long abastohistoId) { + this.abastohistoId = abastohistoId; + } + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "TIPOMOVIMENTACION_ID") + public TipoMovimentacion getTipoMovimentacion() { + return this.tipoMovimentacion; + } + + public void setTipoMovimentacion(TipoMovimentacion tipoMovimentacion) { + this.tipoMovimentacion = tipoMovimentacion; + } + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "AIDF_ID") + public Aidf getAidf() { + return this.aidf; + } + + public void setAidf(Aidf aidf) { + this.aidf = aidf; + } + + @Column(name = "NUMSERIEPREIMPRESA", length = 10) + public String getNumseriepreimpresa() { + return this.numseriepreimpresa; + } + + public void setNumseriepreimpresa(String numseriepreimpresa) { + this.numseriepreimpresa = numseriepreimpresa; + } + + @Column(name = "NUMFOLIOPREIMPRESO", length = 12) + public String getNumfoliopreimpreso() { + return this.numfoliopreimpreso; + } + + public void setNumfoliopreimpreso(String numfoliopreimpreso) { + this.numfoliopreimpreso = numfoliopreimpreso; + } + + @Column(name = "NUMSUBSERIEPREIMPRESO", length = 10) + public String getNumsubseriepreimpreso() { + return this.numsubseriepreimpreso; + } + + public void setNumsubseriepreimpreso(String numsubseriepreimpreso) { + this.numsubseriepreimpreso = numsubseriepreimpreso; + } + + @Temporal(TemporalType.DATE) + @Column(name = "FECHORHISTO", length = 7) + public Date getFechorhisto() { + return this.fechorhisto; + } + + public void setFechorhisto(Date fechorhisto) { + this.fechorhisto = fechorhisto; + } + + @JoinColumn(name = "PUNTOVENTA_ID") + @ManyToOne + public PuntoVenta getPuntoventa() { + return this.puntoventa; + } + + public void setPuntoventa(PuntoVenta puntoventa) { + this.puntoventa = puntoventa; + } + + @Column(name = "ACTIVO", precision = 1, scale = 0) + public Boolean getActivo() { + return this.activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "FECMODIF", length = 7) + public Date getFecmodif() { + return this.fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + @Column(name = "USUARIO_ID", precision = 7, scale = 0) + public Integer getUsuarioId() { + return this.usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @ManyToOne + @JoinColumn(name = "ESTACION_ID") + public Estacion getEstacion() { + return estacion; + } + + public void setEstacion(Estacion estacion) { + this.estacion = estacion; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/Aidf.java b/src/com/rjconsultores/ventaboletos/entidad/Aidf.java new file mode 100644 index 000000000..4264fc10d --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/Aidf.java @@ -0,0 +1,259 @@ +package com.rjconsultores.ventaboletos.entidad; + +// Generated 26/10/2013 14:51:58 by Hibernate Tools 3.4.0.CR1 + +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * Aidf generated by hbm2java + */ +@Entity +@Table(name = "AIDF") +public class Aidf implements java.io.Serializable { + + private Long aidfId; + private AidfTipo aidfTipo; + private AidfEspecie aidfEspecie; + private Estado estado; + private String docfiscal; + private String acfiscal; + private String serie; + private String subserie; + private String forminicial; + private String formfinal; + private Date fecadquisicion; + private Date fecvencimiento; + private String inscestadual; + private Empresa empresa; + private Boolean activo; + private Date fecmodif; + private Integer usuarioId; + + public Aidf() { + } + + public Aidf(AidfTipo _aidfTipo, AidfEspecie _aidfEspecie, Estado _estado, String _docfiscal, String _acfiscal, + String _serie, String _subserie, String _forminicial, String _formfinal, Date _fecadquisicion, Date _fecvencimiento, + String _inscestadual, Empresa _empresa, Boolean _activo, Date _fecmodif, Integer _usuarioId) { + aidfTipo = _aidfTipo; + aidfEspecie = _aidfEspecie; + estado = _estado; + docfiscal = _docfiscal; + acfiscal = _acfiscal; + serie = _serie; + subserie = _subserie; + forminicial = _forminicial; + formfinal = _formfinal; + fecadquisicion = _fecadquisicion; + fecvencimiento = _fecvencimiento; + inscestadual = _inscestadual; + empresa = _empresa; + activo = _activo; + fecmodif = _fecmodif; + usuarioId = _usuarioId; + } + + @Override + public String toString() { + return String.format("%s - %s", docfiscal, acfiscal); + } + + @Override + public int hashCode() { + int hash = 0; + hash += (aidfId != null ? aidfId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof Aidf)) + return false; + + Aidf other = (Aidf) object; + if ((this.aidfId == null && other.aidfId != null) || (this.aidfId != null && !this.aidfId.equals(other.aidfId))) { + return false; + } + return true; + } + + @SequenceGenerator(name = "AIDF_SEQ", sequenceName = "AIDF_SEQ", allocationSize = 1) + @Id + @GeneratedValue(strategy = GenerationType.AUTO, generator = "AIDF_SEQ") + @Column(name = "AIDF_ID", unique = true, nullable = false, precision = 15, scale = 0) + public Long getAidfId() { + return aidfId; + } + + public void setAidfId(Long _aidfId) { + aidfId = _aidfId; + } + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "AIDFTIPO_ID") + public AidfTipo getAidfTipo() { + return aidfTipo; + } + + public void setAidfTipo(AidfTipo _aidfTipo) { + aidfTipo = _aidfTipo; + } + + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "AIDFESP_ID") + public AidfEspecie getAidfEspecie() { + return aidfEspecie; + } + + public void setAidfEspecie(AidfEspecie _aidfEspecie) { + aidfEspecie = _aidfEspecie; + } + + @JoinColumn(name = "ESTADO_ID") + @ManyToOne + public Estado getEstado() { + return estado; + } + + public void setEstado(Estado _estado) { + estado = _estado; + } + + @Column(name = "DOCFISCAL", length = 20) + public String getDocfiscal() { + return docfiscal; + } + + public void setDocfiscal(String _docfiscal) { + docfiscal = _docfiscal; + } + + @Column(name = "ACFISCAL", length = 20) + public String getAcfiscal() { + return acfiscal; + } + + public void setAcfiscal(String _acfiscal) { + acfiscal = _acfiscal; + } + + @Column(name = "SERIE", length = 20) + public String getSerie() { + return serie; + } + + public void setSerie(String _serie) { + serie = _serie; + } + + @Column(name = "SUBSERIE", length = 20) + public String getSubserie() { + return subserie; + } + + public void setSubserie(String _subserie) { + subserie = _subserie; + } + + @Column(name = "FORMINICIAL", length = 12) + public String getForminicial() { + return forminicial; + } + + public void setForminicial(String _forminicial) { + forminicial = _forminicial; + } + + @Column(name = "FORMFINAL", length = 12) + public String getFormfinal() { + return formfinal; + } + + public void setFormfinal(String _formfinal) { + formfinal = _formfinal; + } + + @Temporal(TemporalType.DATE) + @Column(name = "FECADQUISICION", length = 7) + public Date getFecadquisicion() { + return fecadquisicion; + } + + public void setFecadquisicion(Date _fecadquisicion) { + fecadquisicion = _fecadquisicion; + } + + @Temporal(TemporalType.DATE) + @Column(name = "FECVENCIMIENTO", length = 7) + public Date getFecvencimiento() { + return fecvencimiento; + } + + public void setFecvencimiento(Date _fecvencimiento) { + fecvencimiento = _fecvencimiento; + } + + @Column(name = "INSCESTADUAL", length = 20) + public String getInscestadual() { + return inscestadual; + } + + public void setInscestadual(String _inscestadual) { + inscestadual = _inscestadual; + } + + @JoinColumn(name = "EMPRESA_ID") + @ManyToOne + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa _empresa) { + empresa = _empresa; + } + + @Column(name = "ACTIVO", precision = 1, scale = 0) + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean _activo) { + activo = _activo; + } + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "FECMODIF", length = 7) + public Date getFecmodif() { + return fecmodif; + } + + public void setFecmodif(Date _fecmodif) { + fecmodif = _fecmodif; + } + + @Column(name = "USUARIO_ID", precision = 7, scale = 0) + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer _usuarioId) { + usuarioId = _usuarioId; + } + + + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/AidfEspecie.java b/src/com/rjconsultores/ventaboletos/entidad/AidfEspecie.java new file mode 100644 index 000000000..69323235a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/AidfEspecie.java @@ -0,0 +1,113 @@ +package com.rjconsultores.ventaboletos.entidad; + +// Generated 26/10/2013 14:51:58 by Hibernate Tools 3.4.0.CR1 + +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * AidfEspecie generated by hbm2java + */ +@Entity +@Table(name = "AIDF_ESPECIE") +public class AidfEspecie implements java.io.Serializable { + + private Integer aidfespId; + private String decespecie; + private Boolean activo; + private Date fecmodif; + private Integer usuarioId; + + public AidfEspecie() { + } + + public AidfEspecie(Integer aidfespId) { + this.aidfespId = aidfespId; + } + + @Override + public String toString() { + return decespecie; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (aidfespId != null ? aidfespId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof AidfEspecie)) + return false; + + AidfEspecie other = (AidfEspecie) object; + if ((this.aidfespId == null && other.aidfespId != null) || (this.aidfespId != null && !this.aidfespId.equals(other.aidfespId))) { + return false; + } + return true; + } + + public AidfEspecie(Integer aidfespId, String decespecie, Boolean activo, Date fecmodif, Integer usuarioId) { + this.aidfespId = aidfespId; + this.decespecie = decespecie; + this.activo = activo; + this.fecmodif = fecmodif; + this.usuarioId = usuarioId; + } + + @Id + @Column(name = "AIDFESP_ID", unique = true, nullable = false, precision = 4, scale = 0) + public Integer getAidfespId() { + return this.aidfespId; + } + + public void setAidfespId(Integer aidfespId) { + this.aidfespId = aidfespId; + } + + @Column(name = "DECESPECIE", length = 20) + public String getDecespecie() { + return this.decespecie; + } + + public void setDecespecie(String decespecie) { + this.decespecie = decespecie; + } + + @Column(name = "ACTIVO", precision = 1, scale = 0) + public Boolean getActivo() { + return this.activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "FECMODIF", length = 7) + public Date getFecmodif() { + return this.fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + @Column(name = "USUARIO_ID", precision = 7, scale = 0) + public Integer getUsuarioId() { + return this.usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/AidfTipo.java b/src/com/rjconsultores/ventaboletos/entidad/AidfTipo.java new file mode 100644 index 000000000..852043922 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/AidfTipo.java @@ -0,0 +1,113 @@ +package com.rjconsultores.ventaboletos.entidad; + +// Generated 26/10/2013 14:51:58 by Hibernate Tools 3.4.0.CR1 + +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * AidfTipo generated by hbm2java + */ +@Entity +@Table(name = "AIDF_TIPO") +public class AidfTipo implements java.io.Serializable { + + private Integer aidftipoId; + private String desctipo; + private Boolean activo; + private Date fecmodif; + private Integer usuarioId; + + public AidfTipo() { + } + + public AidfTipo(Integer aidftipoId) { + this.aidftipoId = aidftipoId; + } + + @Override + public String toString() { + return desctipo; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (aidftipoId != null ? aidftipoId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof AidfTipo)) + return false; + + AidfTipo other = (AidfTipo) object; + if ((this.aidftipoId == null && other.aidftipoId != null) || (this.aidftipoId != null && !this.aidftipoId.equals(other.aidftipoId))) { + return false; + } + return true; + } + + public AidfTipo(Integer aidftipoId, String desctipo, Boolean activo, Date fecmodif, Integer usuarioId) { + this.aidftipoId = aidftipoId; + this.desctipo = desctipo; + this.activo = activo; + this.fecmodif = fecmodif; + this.usuarioId = usuarioId; + } + + @Id + @Column(name = "AIDFTIPO_ID", unique = true, nullable = false, precision = 4, scale = 0) + public Integer getAidftipoId() { + return this.aidftipoId; + } + + public void setAidftipoId(Integer aidftipoId) { + this.aidftipoId = aidftipoId; + } + + @Column(name = "DESCTIPO", length = 20) + public String getDesctipo() { + return this.desctipo; + } + + public void setDesctipo(String desctipo) { + this.desctipo = desctipo; + } + + @Column(name = "ACTIVO", precision = 1, scale = 0) + public Boolean getActivo() { + return this.activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "FECMODIF", length = 7) + public Date getFecmodif() { + return this.fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + @Column(name = "USUARIO_ID", precision = 7, scale = 0) + public Integer getUsuarioId() { + return this.usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/Estacion.java b/src/com/rjconsultores/ventaboletos/entidad/Estacion.java index 7422c6692..e5b197f7e 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/Estacion.java +++ b/src/com/rjconsultores/ventaboletos/entidad/Estacion.java @@ -256,6 +256,6 @@ public class Estacion implements Serializable { @Override public String toString() { - return "com.rjconsultores.ventaboletos.entidad.Estacion[estacionId=" + estacionId + "]"; + return descestacion; } } diff --git a/src/com/rjconsultores/ventaboletos/entidad/PtovtaTipoEstoque.java b/src/com/rjconsultores/ventaboletos/entidad/PtovtaTipoEstoque.java new file mode 100644 index 000000000..50bef2f3f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/PtovtaTipoEstoque.java @@ -0,0 +1,117 @@ +package com.rjconsultores.ventaboletos.entidad; + +// Generated 26/10/2013 14:51:58 by Hibernate Tools 3.4.0.CR1 + +import java.util.Date; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * PtovtaTipoEstoque generated by hbm2java + */ +@Entity +@Table(name = "PTOVTA_TIPO_ESTOQUE") +public class PtovtaTipoEstoque implements java.io.Serializable { + + public static final int TIPO_CONTABILIDAD = 1; + public static final int TIPO_SUMINISTRO = 2; + public static final int TIPO_NORMAL = 3; + + private Integer ptovtatipoestId; + private String desctipoest; + private Boolean activo; + private Date fecmodif; + private Integer usuarioId; + + public PtovtaTipoEstoque() { + } + + public PtovtaTipoEstoque(Integer ptovtatipoestId) { + this.ptovtatipoestId = ptovtatipoestId; + } + + public PtovtaTipoEstoque(Integer ptovtatipoestId, String desctipoest, Boolean activo, Date fecmodif, Integer usuarioId) { + this.ptovtatipoestId = ptovtatipoestId; + this.desctipoest = desctipoest; + this.activo = activo; + this.fecmodif = fecmodif; + this.usuarioId = usuarioId; + } + + @Override + public String toString() { + return desctipoest; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (ptovtatipoestId != null ? ptovtatipoestId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof PtovtaTipoEstoque)) + return false; + + PtovtaTipoEstoque other = (PtovtaTipoEstoque) object; + if ((this.ptovtatipoestId == null && other.ptovtatipoestId != null) || (this.ptovtatipoestId != null && !this.ptovtatipoestId.equals(other.ptovtatipoestId))) { + return false; + } + return true; + } + + @Id + @Column(name = "PTOVTATIPOEST_ID", unique = true, nullable = false, precision = 4, scale = 0) + public Integer getPtovtatipoestId() { + return this.ptovtatipoestId; + } + + public void setPtovtatipoestId(Integer ptovtatipoestId) { + this.ptovtatipoestId = ptovtatipoestId; + } + + @Column(name = "DESCTIPOEST", length = 20) + public String getDesctipoest() { + return this.desctipoest; + } + + public void setDesctipoest(String desctipoest) { + this.desctipoest = desctipoest; + } + + @Column(name = "ACTIVO", precision = 1, scale = 0) + public Boolean getActivo() { + return this.activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "FECMODIF", length = 7) + public Date getFecmodif() { + return this.fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + @Column(name = "USUARIO_ID", precision = 7, scale = 0) + public Integer getUsuarioId() { + return this.usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/PuntoVenta.java b/src/com/rjconsultores/ventaboletos/entidad/PuntoVenta.java index f6c6e09a8..0854f19e8 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/PuntoVenta.java +++ b/src/com/rjconsultores/ventaboletos/entidad/PuntoVenta.java @@ -136,6 +136,18 @@ public class PuntoVenta implements Serializable { @JoinColumn(name = "PUNTOVENTAPADRE_ID") private PuntoVenta puntoVentaPadre; + @JoinColumn(name = "PTOVTATIPOEST_ID") + @ManyToOne + private PtovtaTipoEstoque ptovtaTipoEstoque; + + public PtovtaTipoEstoque getPtovtaTipoEstoque() { + return ptovtaTipoEstoque; + } + + public void setPtovtaTipoEstoque(PtovtaTipoEstoque ptovtaTipoEstoque) { + this.ptovtaTipoEstoque = ptovtaTipoEstoque; + } + public PtovtaComissao getComissaoId() { return comissaoId; } diff --git a/src/com/rjconsultores/ventaboletos/entidad/TipoMovimentacion.java b/src/com/rjconsultores/ventaboletos/entidad/TipoMovimentacion.java new file mode 100644 index 000000000..f6aac9cc5 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/TipoMovimentacion.java @@ -0,0 +1,124 @@ +package com.rjconsultores.ventaboletos.entidad; + +// Generated 26/10/2013 14:51:58 by Hibernate Tools 3.4.0.CR1 + +import java.util.Date; +import java.util.HashSet; +import java.util.Set; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.FetchType; +import javax.persistence.Id; +import javax.persistence.OneToMany; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +/** + * TipoMovimentacion generated by hbm2java + */ +@Entity +@Table(name = "TIPO_MOVIMENTACION") +public class TipoMovimentacion implements java.io.Serializable { + + public static final int TIPO_ADQUISICION = 1; + public static final int TIPO_ENVIO = 2; + public static final int TIPO_VOLVER = 3; + public static final int TIPO_TRANSFERENCIA = 4; + public static final int TIPO_PERDIDO = 5; + public static final int TIPO_AJUSTE = 6; + + private Integer tipomovimentacionId; + private String desctipomovimentacion; + private Boolean activo; + private Date fecmodif; + private Integer usuarioId; + + public TipoMovimentacion() { + } + + public TipoMovimentacion(Integer tipomovimentacionId) { + this.tipomovimentacionId = tipomovimentacionId; + } + + public TipoMovimentacion(Integer tipomovimentacionId, String desctipomovimentacion, Boolean activo, Date fecmodif, Integer usuarioId) { + this.tipomovimentacionId = tipomovimentacionId; + this.desctipomovimentacion = desctipomovimentacion; + this.activo = activo; + this.fecmodif = fecmodif; + this.usuarioId = usuarioId; + } + + @Override + public String toString() { + return desctipomovimentacion; + } + + @Override + public int hashCode() { + int hash = 0; + hash += (tipomovimentacionId != null ? tipomovimentacionId.hashCode() : 0); + return hash; + } + + @Override + public boolean equals(Object object) { + // TODO: Warning - this method won't work in the case the id fields are not set + if (!(object instanceof TipoMovimentacion)) + return false; + + TipoMovimentacion other = (TipoMovimentacion) object; + if ((this.tipomovimentacionId == null && other.tipomovimentacionId != null) || (this.tipomovimentacionId != null && !this.tipomovimentacionId.equals(other.tipomovimentacionId))) { + return false; + } + return true; + } + + + @Id + @Column(name = "TIPOMOVIMENTACION_ID", unique = true, nullable = false, precision = 4, scale = 0) + public Integer getTipomovimentacionId() { + return this.tipomovimentacionId; + } + + public void setTipomovimentacionId(Integer tipomovimentacionId) { + this.tipomovimentacionId = tipomovimentacionId; + } + + @Column(name = "DESCTIPOMOVIMENTACION", length = 20) + public String getDesctipomovimentacion() { + return this.desctipomovimentacion; + } + + public void setDesctipomovimentacion(String desctipomovimentacion) { + this.desctipomovimentacion = desctipomovimentacion; + } + + @Column(name = "ACTIVO", precision = 1, scale = 0) + public Boolean getActivo() { + return this.activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + @Temporal(TemporalType.TIMESTAMP) + @Column(name = "FECMODIF", length = 7) + public Date getFecmodif() { + return this.fecmodif; + } + + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } + + @Column(name = "USUARIO_ID", precision = 7, scale = 0) + public Integer getUsuarioId() { + return this.usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/AbastoCentralService.java b/src/com/rjconsultores/ventaboletos/service/AbastoCentralService.java new file mode 100644 index 000000000..d9f9d4da6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/AbastoCentralService.java @@ -0,0 +1,12 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.AbastoCentral; +import com.rjconsultores.ventaboletos.entidad.Aidf; + + +public interface AbastoCentralService extends GenericService { + + public List buscaBilhetesPorAidf(Aidf aidf); +} diff --git a/src/com/rjconsultores/ventaboletos/service/AbastoHistoService.java b/src/com/rjconsultores/ventaboletos/service/AbastoHistoService.java new file mode 100644 index 000000000..b0bdbae9f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/AbastoHistoService.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.AbastoCentral; +import com.rjconsultores.ventaboletos.entidad.AbastoHisto; +import com.rjconsultores.ventaboletos.entidad.TipoMovimentacion; + +public interface AbastoHistoService extends GenericService { + +} diff --git a/src/com/rjconsultores/ventaboletos/service/AidfService.java b/src/com/rjconsultores/ventaboletos/service/AidfService.java new file mode 100644 index 000000000..13dd201c1 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/AidfService.java @@ -0,0 +1,16 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Aidf; +import com.rjconsultores.ventaboletos.entidad.AidfEspecie; +import com.rjconsultores.ventaboletos.entidad.AidfTipo; +import com.rjconsultores.ventaboletos.entidad.Empresa; + +public interface AidfService extends GenericService { + + public List obtenerTodosAdifEspecie(); + public List obtenerTodosAdifTipo(); + public List buscaAidfsPorEmpresas(List empresas); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/EstacionService.java b/src/com/rjconsultores/ventaboletos/service/EstacionService.java index 67762aa2f..8d96743cb 100644 --- a/src/com/rjconsultores/ventaboletos/service/EstacionService.java +++ b/src/com/rjconsultores/ventaboletos/service/EstacionService.java @@ -8,6 +8,7 @@ import java.util.List; import com.rjconsultores.ventaboletos.entidad.Estacion; import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.entidad.Usuario; import com.rjconsultores.ventaboletos.exception.BusinessException; /** @@ -36,4 +37,6 @@ public interface EstacionService { public List buscar(String descMac); public Long getDecimalMAC(String mac); + + public List buscarEstaciones(PuntoVenta puntoVenta); } diff --git a/src/com/rjconsultores/ventaboletos/service/MovimentacionBilhetesService.java b/src/com/rjconsultores/ventaboletos/service/MovimentacionBilhetesService.java new file mode 100644 index 000000000..bbca26e46 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/MovimentacionBilhetesService.java @@ -0,0 +1,33 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.AbastoHisto; +import com.rjconsultores.ventaboletos.entidad.Aidf; +import com.rjconsultores.ventaboletos.entidad.Estacion; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.entidad.TipoMovimentacion; + +public interface MovimentacionBilhetesService { + + public List obtenerHistoricoMovimetacion(String numBilhete); + public List obtenerHistoricoMovimetacion(Aidf aidf); + public List obtenerHistoricoMovimetacion(Aidf aidf, Date fecInicial, Date fecFinal); + public List obtenerTiposMovimetacion(); + + + public void realizaAdquisicionBilhetes(Aidf aidf); + public void realizaMovimentacionBilhetes(Aidf aidf, PuntoVenta origem, PuntoVenta destino, TipoMovimentacion tipoMovimentacion); + public void realizaMovimentacionBilhetes(Aidf aidf, PuntoVenta origem, PuntoVenta destino, Long cantidad, TipoMovimentacion tipoMovimentacion); + public void realizaMovimentacionBilhetes(Aidf aidf, PuntoVenta origem, PuntoVenta destino, String formInicial, String formFinal, TipoMovimentacion tipoMovimentacion); + + public PuntoVenta buscarAgSuprimento(); + public PuntoVenta buscarAgContabilidade(); + + public List obtenerTiposMovimetacionPuntoVenta(); + public void realizaMovimentacionBilhetes(PuntoVenta puntoVentaBilhetes, Estacion origem, Estacion destino, TipoMovimentacion tipoMovimentacion); + public void realizaMovimentacionBilhetes(PuntoVenta puntoVentaBilhetes, Estacion origem, Estacion destino, String formInicial, Long cantidad, TipoMovimentacion tipoMovimentacion); + public void realizaMovimentacionBilhetes(PuntoVenta puntoVentaBilhetes, Estacion origem, Estacion destino, String formInicial, String formFinal, TipoMovimentacion tipoMovimentacion); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/PuntoVentaService.java b/src/com/rjconsultores/ventaboletos/service/PuntoVentaService.java index 4e55f3c36..868f9c120 100644 --- a/src/com/rjconsultores/ventaboletos/service/PuntoVentaService.java +++ b/src/com/rjconsultores/ventaboletos/service/PuntoVentaService.java @@ -4,9 +4,12 @@ */ package com.rjconsultores.ventaboletos.service; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Empresa; import com.rjconsultores.ventaboletos.entidad.Parada; import com.rjconsultores.ventaboletos.entidad.PuntoVenta; -import java.util.List; +import com.rjconsultores.ventaboletos.entidad.Usuario; /** * @@ -33,4 +36,8 @@ public interface PuntoVentaService { public List buscaPuntoVentaParada(Parada paradaId); public List buscarPuntoVentaSubordinados(PuntoVenta puntoVenta); + + public List buscarPuntosVentaMovimentacionBilhetes(List empresas); + + public List buscarPuntosVentaPorUsuario(Usuario usuario); } diff --git a/src/com/rjconsultores/ventaboletos/service/impl/AbastoCentralServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/AbastoCentralServiceImpl.java new file mode 100644 index 000000000..f28f3a4eb --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/AbastoCentralServiceImpl.java @@ -0,0 +1,56 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.rjconsultores.ventaboletos.dao.AbastoCentralDAO; +import com.rjconsultores.ventaboletos.entidad.AbastoCentral; +import com.rjconsultores.ventaboletos.entidad.Aidf; +import com.rjconsultores.ventaboletos.service.AbastoCentralService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("abastoCentralService") +public class AbastoCentralServiceImpl implements AbastoCentralService { + + @Autowired + private AbastoCentralDAO abastoCentralDAO; + + public List obtenerTodos() { + return abastoCentralDAO.obtenerTodos(); + } + + public AbastoCentral obtenerID(Long id) { + return abastoCentralDAO.obtenerID(id); + } + + public AbastoCentral suscribir(AbastoCentral entidad) { + setUsuarioFecmodifActivo(entidad); + return abastoCentralDAO.suscribir(entidad); + } + + public AbastoCentral actualizacion(AbastoCentral entidad) { + setUsuarioFecmodifActivo(entidad); + return abastoCentralDAO.actualizacion(entidad); + } + + public void borrar(AbastoCentral entidad) { + setUsuarioFecmodifActivo(entidad); + entidad.setActivo(Boolean.FALSE); + abastoCentralDAO.borrar(entidad); + } + + private void setUsuarioFecmodifActivo(AbastoCentral entidad){ + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + } + + public List buscaBilhetesPorAidf(Aidf aidf) { + List bilhetes = abastoCentralDAO.buscaBilhetesPorAidf(aidf); + return bilhetes; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/AbastoHistoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/AbastoHistoServiceImpl.java new file mode 100644 index 000000000..96301b06c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/AbastoHistoServiceImpl.java @@ -0,0 +1,49 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.List; + +import org.springframework.stereotype.Service; + +import com.rjconsultores.ventaboletos.dao.hibernate.GenericHibernateDAO; +import com.rjconsultores.ventaboletos.entidad.AbastoCentral; +import com.rjconsultores.ventaboletos.entidad.AbastoHisto; +import com.rjconsultores.ventaboletos.service.AbastoHistoService; + +@Service("abastoHistoService") +public class AbastoHistoServiceImpl implements AbastoHistoService { + + @Override + public List obtenerTodos() { + // TODO Auto-generated method stub + return null; + } + + @Override + public AbastoHisto obtenerID(Long id) { + // TODO Auto-generated method stub + return null; + } + + @Override + public AbastoHisto suscribir(AbastoHisto entidad) { + // TODO Auto-generated method stub + return null; + } + + @Override + public AbastoHisto actualizacion(AbastoHisto entidad) { + // TODO Auto-generated method stub + return null; + } + + @Override + public void borrar(AbastoHisto entidad) { + // TODO Auto-generated method stub + + } + + + + + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/AidfServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/AidfServiceImpl.java new file mode 100644 index 000000000..c27cebd82 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/AidfServiceImpl.java @@ -0,0 +1,90 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.Calendar; +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.criterion.Restrictions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.AidfDAO; +import com.rjconsultores.ventaboletos.dao.AidfEspecieDAO; +import com.rjconsultores.ventaboletos.dao.AidfTipoDAO; +import com.rjconsultores.ventaboletos.entidad.Aidf; +import com.rjconsultores.ventaboletos.entidad.AidfEspecie; +import com.rjconsultores.ventaboletos.entidad.AidfTipo; +import com.rjconsultores.ventaboletos.entidad.Empresa; +import com.rjconsultores.ventaboletos.service.AidfService; +import com.rjconsultores.ventaboletos.service.MovimentacionBilhetesService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("aidfService") +public class AidfServiceImpl implements AidfService { + + @Autowired + private AidfDAO aidfDAO; + + @Autowired + private AidfEspecieDAO aidfEspecieDAO; + + @Autowired + private AidfTipoDAO aidfTipoDAO; + + @Autowired + private MovimentacionBilhetesService movimentacionBilhetesService; + + public List obtenerTodos() { + return aidfDAO.obtenerTodos(); + } + + @Transactional + public Aidf obtenerID(Long id) { + return aidfDAO.obtenerID(id); + } + + @Transactional + public Aidf suscribir(Aidf entidad) { + setUsuarioFecmodifActivo(entidad); + + Aidf aidf = aidfDAO.suscribir(entidad); + + if(aidf != null) + movimentacionBilhetesService.realizaAdquisicionBilhetes(aidf); + + return aidf; + } + + @Transactional + public Aidf actualizacion(Aidf entidad) { + setUsuarioFecmodifActivo(entidad); + return aidfDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Aidf entidad) { + setUsuarioFecmodifActivo(entidad); + entidad.setActivo(Boolean.FALSE); + aidfDAO.borrar(entidad); + } + + private void setUsuarioFecmodifActivo(Aidf entidad){ + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + } + + public List obtenerTodosAdifEspecie() { + return aidfEspecieDAO.obtenerTodos(); + } + + public List obtenerTodosAdifTipo() { + return aidfTipoDAO.obtenerTodos(); + } + + public List buscaAidfsPorEmpresas(List empresas) { + List aidfs = aidfDAO.buscaAidfsPorEmpresas(empresas); + return aidfs; + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/EstacionServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/EstacionServiceImpl.java index 501c5c102..317bbf36f 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/EstacionServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/EstacionServiceImpl.java @@ -15,6 +15,7 @@ import com.rjconsultores.ventaboletos.dao.EstacionDAO; import com.rjconsultores.ventaboletos.entidad.Estacion; import com.rjconsultores.ventaboletos.entidad.EstacionSitef; import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.entidad.Usuario; import com.rjconsultores.ventaboletos.exception.BusinessException; import com.rjconsultores.ventaboletos.service.EstacionService; import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; @@ -111,4 +112,11 @@ public class EstacionServiceImpl implements EstacionService { mac = mac.replace("-", ""); return Long.parseLong(mac, 16); } + + @Override + public List buscarEstaciones(PuntoVenta puntoVenta) { + List estaciones = estacionDAO.buscarEstaciones(puntoVenta); + return estaciones; + } + } diff --git a/src/com/rjconsultores/ventaboletos/service/impl/MovimentacionBilhetesServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/MovimentacionBilhetesServiceImpl.java new file mode 100644 index 000000000..271cfcdaf --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/MovimentacionBilhetesServiceImpl.java @@ -0,0 +1,196 @@ +package com.rjconsultores.ventaboletos.service.impl; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.AbastoCentralDAO; +import com.rjconsultores.ventaboletos.dao.AbastoHistoDAO; +import com.rjconsultores.ventaboletos.dao.AidfDAO; +import com.rjconsultores.ventaboletos.dao.PtovtaTipoEstoqueDAO; +import com.rjconsultores.ventaboletos.dao.PuntoVentaDAO; +import com.rjconsultores.ventaboletos.dao.TipoMovimentacionDAO; +import com.rjconsultores.ventaboletos.entidad.AbastoCentral; +import com.rjconsultores.ventaboletos.entidad.AbastoHisto; +import com.rjconsultores.ventaboletos.entidad.Aidf; +import com.rjconsultores.ventaboletos.entidad.Estacion; +import com.rjconsultores.ventaboletos.entidad.PtovtaTipoEstoque; +import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.entidad.TipoMovimentacion; +import com.rjconsultores.ventaboletos.service.MovimentacionBilhetesService; +import com.rjconsultores.ventaboletos.service.PuntoVentaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("movimentacioBilhetesService") +public class MovimentacionBilhetesServiceImpl implements MovimentacionBilhetesService { + + @Autowired + private AidfDAO aidfDAO; + + @Autowired + private AbastoCentralDAO abastoCentralDAO; + + @Autowired + private AbastoHistoDAO abastoHistoDAO; + + @Autowired + private TipoMovimentacionDAO tipoMovimentacionDAO; + + @Autowired + private PuntoVentaDAO puntoVentaDAO; + + @Autowired + private PtovtaTipoEstoqueDAO ptovtaTipoEstoqueDAO; + + public MovimentacionBilhetesServiceImpl() { + // TODO Auto-generated constructor stub + } + + @Override + public List obtenerHistoricoMovimetacion(String numBilhete) { + + return null; + } + + @Override + public List obtenerHistoricoMovimetacion(Aidf aidf) { + // TODO Auto-generated method stub + return null; + } + + @Override + public List obtenerHistoricoMovimetacion(Aidf aidf, Date fecInicial, Date fecFinal) { + // TODO Auto-generated method stub + return null; + } + + @Transactional + public void realizaAdquisicionBilhetes(Aidf aidf){ + + PuntoVenta suprimento = buscarAgSuprimento(); + + long formInicial = Long.valueOf(aidf.getForminicial()); + long formFinal = Long.valueOf(aidf.getFormfinal()); + + List bilhetes = new ArrayList(); + + for(long formCorrente = formInicial; formCorrente <= formFinal; formCorrente++){ + AbastoCentral nuevoBilhete = new AbastoCentral(); + nuevoBilhete.setAidf(aidf); + nuevoBilhete.setNumfoliopreimpreso(formCorrente+""); + nuevoBilhete.setNumseriepreimpresa(aidf.getSerie()); + nuevoBilhete.setNumsubseriepreimpreso(aidf.getSubserie()); + nuevoBilhete.setPuntoventa(suprimento); + nuevoBilhete.setFecmodif(Calendar.getInstance().getTime()); + nuevoBilhete.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + nuevoBilhete.setActivo(true); + + bilhetes.add(nuevoBilhete); + } + + abastoCentralDAO.suscribirBilhetes(bilhetes); + + TipoMovimentacion adquisicion = tipoMovimentacionDAO.buscarTipoMovimentacio(TipoMovimentacion.TIPO_ADQUISICION); + abastoHistoDAO.grabaHistoricoBilhetes(bilhetes, adquisicion); + + } + + @Transactional + public void realizaMovimentacionBilhetes(Aidf aidf, PuntoVenta origem, PuntoVenta destino, TipoMovimentacion tipoMovimentacion) { + + if(validaTipoMovimentacao(tipoMovimentacion)){ + List bilhetes = abastoCentralDAO.obtenerBilhetes(aidf, origem); + atualizaBilhetesEGrabaHistorico(bilhetes, destino, tipoMovimentacion); + } + } + + @Transactional + public void realizaMovimentacionBilhetes(Aidf aidf, PuntoVenta origem, PuntoVenta destino, Long cantidad, TipoMovimentacion tipoMovimentacion) { + + if(validaTipoMovimentacao(tipoMovimentacion)){ + Long formInicial = Long.valueOf(aidf.getForminicial()); + Long formFinal = formInicial + cantidad.longValue(); + + realizaMovimentacionBilhetes(aidf, origem, destino, formInicial.toString(), formFinal.toString(), tipoMovimentacion); + + } + } + + @Transactional + public void realizaMovimentacionBilhetes(Aidf aidf, PuntoVenta origem, PuntoVenta destino, String formInicial, String formFinal, TipoMovimentacion tipoMovimentacion) { + + if(validaTipoMovimentacao(tipoMovimentacion)){ + List bilhetes = abastoCentralDAO.obtenerBilhetes(aidf, formInicial, formFinal, origem); + atualizaBilhetesEGrabaHistorico(bilhetes, destino, tipoMovimentacion); + } + } + + private boolean validaTipoMovimentacao(TipoMovimentacion tipoMovimentacion){ + TipoMovimentacion adquisicion = tipoMovimentacionDAO.buscarTipoMovimentacio(TipoMovimentacion.TIPO_ADQUISICION); + return !tipoMovimentacion.equals(adquisicion); + } + + public List obtenerTiposMovimetacion() { + List tiposMovimentacion = tipoMovimentacionDAO.obtenerTodos(); + return tiposMovimentacion; + } + + public PuntoVenta buscarAgSuprimento() { + PtovtaTipoEstoque tipoSuprimento = ptovtaTipoEstoqueDAO.buscarTipoSuprimento(); + PuntoVenta suprimento = puntoVentaDAO.buscarPuntoVentaPorTipoEstoque(tipoSuprimento).get(0); + + return suprimento; + } + + + public PuntoVenta buscarAgContabilidade() { + PtovtaTipoEstoque tipoContabilidade = ptovtaTipoEstoqueDAO.buscarTipoContabilidade(); + PuntoVenta contabilidade = puntoVentaDAO.buscarPuntoVentaPorTipoEstoque(tipoContabilidade).get(0); + + return contabilidade; + } + + public List obtenerTiposMovimetacionPuntoVenta() { + List tipos = tipoMovimentacionDAO.obtenerTiposMovimetacionPuntoVenta(); + return tipos; + } + + @Transactional + public void realizaMovimentacionBilhetes(PuntoVenta puntoVentaBilhetes, Estacion origem, Estacion destino, TipoMovimentacion tipoMovimentacion) { + List bilhetes = abastoCentralDAO.obtenerBilhetesPorPuntoVenta(puntoVentaBilhetes, origem); + atualizaBilhetesEGrabaHistorico(bilhetes, destino, tipoMovimentacion); + } + + @Transactional + public void realizaMovimentacionBilhetes(PuntoVenta puntoVentaBilhetes, Estacion origem, Estacion destino, String _formInicial, Long cantidad, TipoMovimentacion tipoMovimentacion) { + + Long formInicial = Long.valueOf(_formInicial); + Long formFinal = formInicial + cantidad.longValue(); + + realizaMovimentacionBilhetes(puntoVentaBilhetes, origem, destino, formInicial.toString(), formFinal.toString(), tipoMovimentacion); + } + + @Transactional + public void realizaMovimentacionBilhetes(PuntoVenta puntoVentaBilhetes, Estacion origem, Estacion destino, String formInicial, String formFinal, TipoMovimentacion tipoMovimentacion) { + + List bilhetes = abastoCentralDAO.obtenerBilhetesPorPuntoVenta(formInicial, formFinal, puntoVentaBilhetes, origem); + atualizaBilhetesEGrabaHistorico(bilhetes, destino, tipoMovimentacion); + } + + private void atualizaBilhetesEGrabaHistorico(List bilhetes, Estacion destino, TipoMovimentacion tipoMovimentacion){ + + abastoCentralDAO.actualizaBilhetes(bilhetes, destino); + abastoHistoDAO.grabaHistoricoBilhetes(bilhetes, tipoMovimentacion); + } + + private void atualizaBilhetesEGrabaHistorico(List bilhetes, PuntoVenta destino, TipoMovimentacion tipoMovimentacion){ + + abastoCentralDAO.actualizaBilhetes(bilhetes, destino); + abastoHistoDAO.grabaHistoricoBilhetes(bilhetes, tipoMovimentacion); + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PuntoVentaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PuntoVentaServiceImpl.java index b2361af91..ba4be04b4 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/PuntoVentaServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/PuntoVentaServiceImpl.java @@ -11,11 +11,16 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import com.rjconsultores.ventaboletos.dao.EstacionDAO; import com.rjconsultores.ventaboletos.dao.PuntoVentaDAO; +import com.rjconsultores.ventaboletos.dao.UsuarioUbicacionDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; import com.rjconsultores.ventaboletos.entidad.FormaPagoDet; import com.rjconsultores.ventaboletos.entidad.Parada; import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.entidad.Usuario; import com.rjconsultores.ventaboletos.service.PuntoVentaService; +import com.rjconsultores.ventaboletos.service.UsuarioUbicacionService; import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; /** @@ -27,6 +32,9 @@ public class PuntoVentaServiceImpl implements PuntoVentaService { @Autowired private PuntoVentaDAO puntoVentaDAO; + + @Autowired + private UsuarioUbicacionDAO usuarioUbicacionDAO; //FIXME : Remover esse método de quem está usando. Esse método carrega muitos dados @Deprecated @@ -120,10 +128,19 @@ public class PuntoVentaServiceImpl implements PuntoVentaService { return puntoVentaDAO.buscaPuntoVentaParada(paradaId); } - @Override public List buscarPuntoVentaSubordinados(PuntoVenta puntoVenta) { List lsPuntoVentaSubordinados = puntoVentaDAO.buscarPuntoVentaSubordinados(puntoVenta); return lsPuntoVentaSubordinados; } + + public List buscarPuntosVentaMovimentacionBilhetes(List empresas) { + List puntosVenta = puntoVentaDAO.buscarPuntosVentaMovimentacionBilhetes(empresas); + return puntosVenta; + } + + public List buscarPuntosVentaPorUsuario(Usuario usuario) { + List puntosVenta = usuarioUbicacionDAO.buscarPuntoVentaPorUsuario(usuario); + return puntosVenta; + } } diff --git a/src/com/rjconsultores/ventaboletos/service/impl/UsuarioServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/UsuarioServiceImpl.java index af4cd3850..ebbf94bb9 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/UsuarioServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/UsuarioServiceImpl.java @@ -37,7 +37,9 @@ public class UsuarioServiceImpl implements UsuarioService, UserDetailsService { public String encriptarSenha(String login, String senha) { org.springframework.security.authentication.encoding.Md5PasswordEncoder a = new org.springframework.security.authentication.encoding.Md5PasswordEncoder(); - + + System.out.println("sfdsdfsfsdoifiosdfoijsdaoi´jasi´jsd"); + return a.encodePassword(senha, login); } diff --git a/src/hibernate.cfg.xml b/src/hibernate.cfg.xml index 1650e9404..bd876d31c 100644 --- a/src/hibernate.cfg.xml +++ b/src/hibernate.cfg.xml @@ -2,198 +2,204 @@ - - oracle.jdbc.OracleDriver - jdbc:oracle:thin:@sistema.grupoguanabara.net.br:1521:ORCL - vtabol - vtax05 - - org.hibernate.dialect.Oracle10gDialect - true - true 1, false 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + org.hibernate.dialect.Oracle10gDialect + true + true 1, false 0 + oracle.jdbc.OracleDriver + jdbc:oracle:thin:@sistema.grupoguanabara.net.br:1521:ORCL + vtabol + vtax05 + org.hibernate.dialect.Oracle10gDialect + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/hibernate.reveng.xml b/src/hibernate.reveng.xml new file mode 100644 index 000000000..d91ac9249 --- /dev/null +++ b/src/hibernate.reveng.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + ABASTO_HISTO_SEQ + ABASTO_HISTO_SEQ + 1 + + + +
+ + + + + ABASTO_HISTO_SEQ + ABASTO_HISTO_SEQ + 1 + + + +
+ + + + + AIDF_SEQ + AIDF_SEQ + 1 + + + +
+ +
\ No newline at end of file