diff --git a/pom.xml b/pom.xml index 3af643740..732534438 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 br.com.rjconsultores ModelWeb - 1.88.2 + 1.91.0 @@ -176,7 +176,7 @@ br.com.rjconsultores GeneradorBoletosCNAB - 1.7.1 + 1.8.0 log4j diff --git a/src/com/rjconsultores/ventaboletos/anotacao/Renderizado.java b/src/com/rjconsultores/ventaboletos/anotacao/Renderizado.java index 1d8c74109..cd6625385 100644 --- a/src/com/rjconsultores/ventaboletos/anotacao/Renderizado.java +++ b/src/com/rjconsultores/ventaboletos/anotacao/Renderizado.java @@ -5,13 +5,37 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; -@Target(ElementType.FIELD) +/** + * Anotação para marcar campos que devem ser renderizados e utilizados no Render Padrão {@link RenderPadrao}. + * + * A anotação permite configurar um conversor personalizado e especificar a posição de ordenação dos campos. + */ +@Target(ElementType.FIELD) @Retention(RetentionPolicy.RUNTIME) -public @interface Renderizado{ - Class> conversor() default DefaultEnum.class; - - String metodoConversor() default "buscarPeloValor"; - - enum DefaultEnum{ - } +public @interface Renderizado { + + /** + * Define a classe do conversor que será usado para converter o valor do campo. + * + * @return A classe Enum do conversor que deve obrigatoriamente + * implementar o um metodo String buscarPeloValor( String valor). + */ + Class> conversor() default DefaultEnum.class; + + /** + * Define o nome do método do conversor que será chamado para converter o valor do campo. + * + * @return O nome do método do conversor. O padrão é "buscarPeloValor". + */ + String metodoConversor() default "buscarPeloValor"; + + /** + * Define a posição de ordenação do campo. Campos com valores menores são ordenados primeiro. + * + * @return A posição numerica de ordenação do campo . + */ + int posicao() default Integer.MAX_VALUE; + + enum DefaultEnum { + } } \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/dao/RutaDAO.java b/src/com/rjconsultores/ventaboletos/dao/RutaDAO.java index 9a0bbacad..d4b4e3981 100644 --- a/src/com/rjconsultores/ventaboletos/dao/RutaDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/RutaDAO.java @@ -79,5 +79,7 @@ public interface RutaDAO extends GenericDAO { public List buscarPorIds(Integer[] rutaIds); public List buscarPorOrgaoEcasetaPeaje(OrgaoConcedente orgao, Integer[] listCasetaPeaje, Empresa empresa); + + public List buscarRutasPorEmpresaOrgaoConcedenteClaseServicio(Empresa empresa, OrgaoConcedente orgao, ClaseServicio claseServicio); } diff --git a/src/com/rjconsultores/ventaboletos/dao/SolicitudExpresosDAO.java b/src/com/rjconsultores/ventaboletos/dao/SolicitudExpresosDAO.java new file mode 100644 index 000000000..533498ed6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/SolicitudExpresosDAO.java @@ -0,0 +1,8 @@ +package com.rjconsultores.ventaboletos.dao; + +import com.rjconsultores.ventaboletos.entidad.SolicitudExpreso; +import com.rjconsultores.ventaboletos.entidad.TrayectosExpresos; + +public interface SolicitudExpresosDAO extends GenericDAO{ + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/TrayectosExpresosDAO.java b/src/com/rjconsultores/ventaboletos/dao/TrayectosExpresosDAO.java new file mode 100644 index 000000000..40ed80d32 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/TrayectosExpresosDAO.java @@ -0,0 +1,13 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.SolicitudExpreso; +import com.rjconsultores.ventaboletos.entidad.TarjetaViaje; +import com.rjconsultores.ventaboletos.entidad.TrayectosExpresos; + +public interface TrayectosExpresosDAO extends GenericDAO{ + + List obtenerTrayectosPorServicioId(SolicitudExpreso expreso); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/VoucherDAO.java b/src/com/rjconsultores/ventaboletos/dao/VoucherDAO.java new file mode 100644 index 000000000..60714e5a7 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/VoucherDAO.java @@ -0,0 +1,12 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Voucher; + +public interface VoucherDAO extends GenericDAO { + + public List buscarConsulta(Long voucherId, String numContrato, String nit, String nomeTransportadora, Date dataInicial, Date dataFinal, Integer origemId, Integer destinoId); + +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/GenericHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/GenericHibernateDAO.java index ef40c23d4..bf70a4d48 100644 --- a/src/com/rjconsultores/ventaboletos/dao/hibernate/GenericHibernateDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/GenericHibernateDAO.java @@ -7,10 +7,9 @@ import java.util.ArrayList; import java.util.Collection; import java.util.List; -import com.rjconsultores.ventaboletos.dao.GenericDAO; - import org.hibernate.Criteria; import org.hibernate.HibernateException; +import org.hibernate.Query; import org.hibernate.Session; import org.hibernate.criterion.Criterion; import org.hibernate.criterion.Projections; @@ -24,6 +23,8 @@ import org.hibernate.loader.criteria.CriteriaLoader; import org.hibernate.persister.entity.OuterJoinLoadable; import org.springframework.orm.hibernate3.support.HibernateDaoSupport; +import com.rjconsultores.ventaboletos.dao.GenericDAO; + /** * * @author gleimar diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/RemessaCNABBancosHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/RemessaCNABBancosHibernateDAO.java index 9f561d1ef..81a17ce69 100644 --- a/src/com/rjconsultores/ventaboletos/dao/hibernate/RemessaCNABBancosHibernateDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/RemessaCNABBancosHibernateDAO.java @@ -24,6 +24,7 @@ import org.hibernate.type.StringType; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Repository; +import org.zkoss.util.resource.Labels; import com.rjconsultores.ventaboletos.ArquivoRemessa; import com.rjconsultores.ventaboletos.ArquivoRemessaItem; @@ -73,6 +74,7 @@ import com.rjconsultores.ventaboletos.entidad.PuntoVenta; import com.rjconsultores.ventaboletos.enuns.Aceite; import com.rjconsultores.ventaboletos.enuns.BancoLayout; import com.rjconsultores.ventaboletos.enuns.TipoInscricaoPagador; +import com.rjconsultores.ventaboletos.exception.ComissaoException; import com.rjconsultores.ventaboletos.exception.ValidacaoRemessaException; import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties; import com.rjconsultores.ventaboletos.utilerias.CustomEnum; @@ -1330,7 +1332,7 @@ public class RemessaCNABBancosHibernateDAO extends GenericHibernateDAO impleme } + + @Override + public List buscarRutasPorEmpresaOrgaoConcedenteClaseServicio(Empresa empresa, OrgaoConcedente orgao, ClaseServicio claseServicio) { + + 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)); + } + + if (claseServicio != null && claseServicio.getClaseservicioId() != -1) { + c.add(Restrictions.eq("claseServicio", claseServicio)); + } + + c.addOrder(Order.asc("descruta")); + + return c.list(); + } } diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/SolicitudExpresosHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/SolicitudExpresosHibernateDAO.java new file mode 100644 index 000000000..809f1614a --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/SolicitudExpresosHibernateDAO.java @@ -0,0 +1,19 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import org.hibernate.SessionFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Repository; + +import com.rjconsultores.ventaboletos.dao.SolicitudExpresosDAO; +import com.rjconsultores.ventaboletos.dao.TrayectosExpresosDAO; +import com.rjconsultores.ventaboletos.entidad.SolicitudExpreso; +import com.rjconsultores.ventaboletos.entidad.TrayectosExpresos; + +@Repository("solicitudExpresosDAO") +public class SolicitudExpresosHibernateDAO extends GenericHibernateDAO implements SolicitudExpresosDAO{ + @Autowired + public SolicitudExpresosHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/TrayectosExpresosHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/TrayectosExpresosHibernateDAO.java new file mode 100644 index 000000000..7ce66569c --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/TrayectosExpresosHibernateDAO.java @@ -0,0 +1,33 @@ +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.TarjetaViajeDAO; +import com.rjconsultores.ventaboletos.dao.TrayectosExpresosDAO; +import com.rjconsultores.ventaboletos.entidad.SolicitudExpreso; +import com.rjconsultores.ventaboletos.entidad.TarjetaViaje; +import com.rjconsultores.ventaboletos.entidad.TrayectosExpresos; + +@Repository("trayectosExpresosDAO") +public class TrayectosExpresosHibernateDAO extends GenericHibernateDAO implements TrayectosExpresosDAO{ + @Autowired + public TrayectosExpresosHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTrayectosPorServicioId(SolicitudExpreso expreso) { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("SOLICITUDEXPRESO_ID", expreso.getSolicitudExpresoId())); + + return c.list(); + } +} \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/VoucherHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/VoucherHibernateDAO.java new file mode 100644 index 000000000..d74c0a2e6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/VoucherHibernateDAO.java @@ -0,0 +1,165 @@ +package com.rjconsultores.ventaboletos.dao.hibernate; + +import java.util.Date; +import java.util.List; + +import org.hibernate.Criteria; +import org.hibernate.Query; +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.VoucherDAO; +import com.rjconsultores.ventaboletos.entidad.Voucher; + +@SuppressWarnings("unchecked") +@Repository("voucherDAO") +public class VoucherHibernateDAO extends GenericHibernateDAO implements VoucherDAO { + + @Autowired + public VoucherHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + @Override + public List obtenerTodos() { + Criteria c = getSession().createCriteria(getPersistentClass()); + c.add(Restrictions.eq(ACTIVO, Boolean.TRUE)); + + return c.list(); + } + + @Override + public List buscarConsulta(Long voucherId, + String numContrato, + String nit, + String nomeTransportadora, + Date dataInicial, + Date dataFinal, + Integer origemId, + Integer destinoId) { + + StringBuilder hql = new StringBuilder(); + hql.append("SELECT v, ori.descParada AS descOrigem , des.descParada AS descDestino "); + hql.append("FROM Voucher v "); + + setJoins( numContrato, + nit, + nomeTransportadora, + hql); + + hql.append("WHERE v.activo = 1 "); + + setClausulas(voucherId, + numContrato, + nit, + nomeTransportadora, + dataInicial, + dataFinal, + origemId, + destinoId, + hql); + + hql.append("ORDER BY voucherId "); + + Query query = getSession().createQuery(hql.toString()); + + setParametros(voucherId, + numContrato, + nit, + nomeTransportadora, + dataInicial, + dataFinal, + origemId, + destinoId, + query); + + return query.list(); + } + + private void setJoins(String numContrato, String nit, String nomeTransportadora, StringBuilder hql) { + hql.append("LEFT JOIN Parada ori ON v.origenId = ori.origenId "); + hql.append("LEFT JOIN Parada des ON v.origenId = des.origenId "); + + } + + private void setClausulas(Long voucherId, String numContrato, String nit, String nomeTransportadora, + Date dataInicial, Date dataFinal, Integer origemId, Integer destinoId, StringBuilder hql) { + if(voucherId != null ){ + hql.append(" AND v.voucherId = :voucherId "); + } + + if(numContrato != null ){ + hql.append(" AND v.voucherId = :voucherId "); + } + + if(nit != null ){ + hql.append(" AND v.voucherId = :voucherId "); + } + + if(nomeTransportadora != null ){ + hql.append(" AND v.voucherId = :voucherId "); + } + + if(dataInicial != null ){ + hql.append(" AND v.dataValidade >= :dataInicial "); + } + + if(dataFinal != null ){ + hql.append(" AND v.dataValidade <= :dataFinal "); + } + + if(origemId != null ){ + hql.append(" AND v.origenId = :origemId "); + } + + if(destinoId != null ){ + hql.append(" AND v.destinoId = :destinoId "); + } + } + + private void setParametros(Long voucherId, + String numContrato, + String nit, + String nomeTransportadora, + Date dataInicial, + Date dataFinal, + Integer origemId, + Integer destinoId, + Query query) { + + if(voucherId != null ){ + query.setLong("voucherId", voucherId); + } + + if(numContrato != null ){ + query.setString("numContrato", numContrato); + } + + if(nit != null ){ + query.setString("nit", nit); + } + + if(nomeTransportadora != null ){ + query.setString("nomeTransportadora", nomeTransportadora); + } + + if(dataInicial != null ){ + query.setDate("dataInicial", dataInicial); + } + + if(dataFinal != null ){ + query.setDate("dataFinal", dataFinal); + } + + if(origemId != null ){ + query.setInteger("origemId", origemId); + } + + if(destinoId != null ){ + query.setInteger("destinoId", destinoId); + } + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/AliasClasse.java b/src/com/rjconsultores/ventaboletos/entidad/AliasClasse.java index b3134b426..9b01de354 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/AliasClasse.java +++ b/src/com/rjconsultores/ventaboletos/entidad/AliasClasse.java @@ -16,6 +16,11 @@ import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import org.hibernate.annotations.Parameter; +import org.hibernate.annotations.Type; + +import com.rjconsultores.ventaboletos.enums.EnumClasseServicoConfortoMonitrip; + @Entity @SequenceGenerator(name = "ALIAS_CLASSE_SEQ", sequenceName = "ALIAS_CLASSE_SEQ", allocationSize = 1) @Table(name = "ALIAS_CLASSE_SERVICO") @@ -40,6 +45,14 @@ public class AliasClasse implements Serializable { @JoinColumn(name = "ORGAOCONCEDENTE_ID") private OrgaoConcedente orgaoConcedente; + @OneToOne + @JoinColumn(name = "RUTA_ID") + private Ruta ruta; + + @OneToOne + @JoinColumn(name = "EMPRESA_ID") + private Empresa empresa; + @Column(name = "MENSAGEM") private String mensagem; @@ -52,6 +65,17 @@ public class AliasClasse implements Serializable { @Column(name = "USUARIO_ID") private Integer usuarioId; + + @Column(name = "INDSOMENTEIMPRESSAO") + private Boolean indSomenteImpressao; + + @Type(type = "com.rjconsultores.ventaboletos.constantes.CustomEnumTypeHibernate", parameters = { + @Parameter(name = "type", value = "com.rjconsultores.ventaboletos.constantes.CustomEnumTypeHibernate"), + @Parameter(name = "class", value = "com.rjconsultores.ventaboletos.enums.EnumClasseServicoConfortoMonitrip"), + @Parameter(name = "sqlType", value = "12")/*Types.VARCHAR*/, + @Parameter(name = "enumName", value = "true")}) + @Column(name = "CLASSE_CONFORTO_MONITRIP") + private com.rjconsultores.ventaboletos.enums.EnumClasseServicoConfortoMonitrip classeConfortoMonitrip; public AliasClasse() { super(); @@ -145,4 +169,37 @@ public class AliasClasse implements Serializable { public void setUsuarioId(Integer usuarioId) { this.usuarioId = usuarioId; } + + public EnumClasseServicoConfortoMonitrip getClasseConfortoMonitrip() { + return classeConfortoMonitrip; + } + + public void setClasseConfortoMonitrip(EnumClasseServicoConfortoMonitrip classeConfortoMonitrip) { + this.classeConfortoMonitrip = classeConfortoMonitrip; + } + + public Ruta getRuta() { + return ruta; + } + + public void setRuta(Ruta ruta) { + this.ruta = ruta; + } + + public Empresa getEmpresa() { + return empresa; + } + + public void setEmpresa(Empresa empresa) { + this.empresa = empresa; + } + + public Boolean getIndSomenteImpressao() { + return indSomenteImpressao; + } + + public void setIndSomenteImpressao(Boolean indSomenteImpressao) { + this.indSomenteImpressao = indSomenteImpressao; + } + } diff --git a/src/com/rjconsultores/ventaboletos/entidad/ContratoCorporativo.java b/src/com/rjconsultores/ventaboletos/entidad/ContratoCorporativo.java index 0d8e9a042..aa6139183 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/ContratoCorporativo.java +++ b/src/com/rjconsultores/ventaboletos/entidad/ContratoCorporativo.java @@ -165,5 +165,10 @@ public class ContratoCorporativo implements Serializable { hash = 59 * hash + (this.getContratoId() != null ? this.getContratoId().hashCode() : 0); return hash; } + + @Override + public String toString() { + return this.getContratoId().toString(); + } } \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/entidad/EsquemaCorrida.java b/src/com/rjconsultores/ventaboletos/entidad/EsquemaCorrida.java index 10fc17a1c..45b599d27 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/EsquemaCorrida.java +++ b/src/com/rjconsultores/ventaboletos/entidad/EsquemaCorrida.java @@ -10,6 +10,7 @@ import javax.persistence.Basic; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; +import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; @@ -113,32 +114,32 @@ public class EsquemaCorrida implements Serializable, Auditavel { private String statusCorrida; @JoinColumn(name = "RUTA_ID", referencedColumnName = "RUTA_ID") - @ManyToOne + @ManyToOne(fetch = FetchType.LAZY) private Ruta ruta; @JoinColumn(name = "ROLOPERATIVO_ID", referencedColumnName = "ROLOPERATIVO_ID") - @ManyToOne(cascade = CascadeType.ALL) + @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) private RolOperativo rolOperativo; @JoinColumn(name = "MARCA_ID", referencedColumnName = "MARCA_ID") - @ManyToOne + @ManyToOne(fetch = FetchType.LAZY) private Marca marca; @JoinColumn(name = "ESQUEMAOPERACIONAL_ID", referencedColumnName = "ESQUEMAOPERACIONAL_ID") - @ManyToOne(cascade = CascadeType.ALL) + @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) @AuditarEntidade private EsquemaOperacional esquemaOperacional; @JoinColumn(name = "EMPRESACORRIDA_ID", referencedColumnName = "EMPRESA_ID") - @ManyToOne + @ManyToOne(fetch = FetchType.LAZY) private Empresa empresa; @JoinColumn(name = "EMPRESAINGRESO_ID", referencedColumnName = "EMPRESA_ID") - @ManyToOne + @ManyToOne(fetch = FetchType.LAZY) private Empresa empresa1; @JoinColumn(name = "CLASESERVICIO_ID", referencedColumnName = "CLASESERVICIO_ID") - @ManyToOne(cascade = CascadeType.ALL) + @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) private ClaseServicio claseServicio; @OneToMany(cascade = CascadeType.ALL) @@ -146,7 +147,7 @@ public class EsquemaCorrida implements Serializable, Auditavel { @AuditarLista(auditarEntidades = true, nome = "Localidade") private List esquemaTramoList; - @OneToMany(cascade = CascadeType.PERSIST) + @OneToMany(cascade = CascadeType.PERSIST, fetch = FetchType.LAZY) @JoinColumn(name = "ESQUEMACORRIDA_ID", referencedColumnName = "ESQUEMACORRIDA_ID") @AuditarLista(auditarEntidades = true, nome = "Cotas") private List esquemaAsientoList; @@ -155,11 +156,11 @@ public class EsquemaCorrida implements Serializable, Auditavel { private String tipocorrida; @JoinColumn(name = "ESQUEMAREBOTE_ID", referencedColumnName = "ESQUEMACORRIDA_ID") - @ManyToOne(cascade = CascadeType.ALL) + @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) private EsquemaCorrida esquemaCorridaRebote; @JoinColumn(name = "DIVISION_ID", referencedColumnName = "DIVISION_ID") - @ManyToOne(cascade = CascadeType.ALL) + @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) private Division division; @Column(name = "NUMCORRIDA") @@ -190,14 +191,14 @@ public class EsquemaCorrida implements Serializable, Auditavel { private Boolean indDiaSimDiaNao; @JoinColumn(name = "AUTOBUS_ID", referencedColumnName = "AUTOBUS_ID") - @ManyToOne(cascade = CascadeType.ALL) + @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) private Autobus autoBus; - @OneToMany(mappedBy = "esquemaCorrida", cascade = CascadeType.ALL) + @OneToMany(mappedBy = "esquemaCorrida", cascade = CascadeType.ALL, fetch = FetchType.LAZY) @AuditarLista(auditarEntidades = true, nome = "Embarque/Desembarque") private List lsEsquemaCorridaEmbarqueDesembarque; - @OneToMany(mappedBy = "esquemaCorrida", cascade = CascadeType.ALL) + @OneToMany(mappedBy = "esquemaCorrida", cascade = CascadeType.ALL, fetch = FetchType.LAZY) @AuditarLista(auditarEntidades = true, nome = "Info Tramo>") private List lsEsquemaCorridaInfo; @@ -236,7 +237,7 @@ public class EsquemaCorrida implements Serializable, Auditavel { private Integer minutosAutomacaoHEAte; @JoinColumn(name = "ROLOPERATIVO_SERVICOEXTRA_ID", referencedColumnName = "ROLOPERATIVO_ID") - @ManyToOne(cascade = CascadeType.ALL) + @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) private RolOperativo rolOperativoServicoExtra; @Column(name = "NUMCORRIDA_SERVICOEXTRA") diff --git a/src/com/rjconsultores/ventaboletos/entidad/SolicitudExpreso.java b/src/com/rjconsultores/ventaboletos/entidad/SolicitudExpreso.java new file mode 100644 index 000000000..e6ad4c2f4 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/SolicitudExpreso.java @@ -0,0 +1,426 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.sql.Blob; +import java.util.Arrays; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.Lob; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.hibernate.type.LobType; + +import oracle.sql.BLOB; + +@Entity +@SequenceGenerator(name = "SOLICITUD_EXPRESO_SEQ", sequenceName = "SOLICITUD_EXPRESO_SEQ", allocationSize = 1) +@Table(name = "SOLICITUD_EXPRESO") +public class SolicitudExpreso implements Serializable{ + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "SOLICITUD_EXPRESO_SEQ") + @Column(name = "SOLICITUDEXPRESO_ID") + private Integer solicitudExpresoId; + + @JoinColumn(name = "CIUDADORIGEN_ID") + @OneToOne + private Ciudad ciudadOrigen; + + @JoinColumn(name = "CIUDADDESTINO_ID") + @OneToOne + private Ciudad ciudadDestino; + + @Column(name = "CANTPASAJEROS") + private Integer cantidadPasajeros; + + @Column(name = "FECSOLICITUD") + @Temporal(TemporalType.TIMESTAMP) + private Date fechaSolicitud; + + @JoinColumn(name = "TIPOIDENTIFICACION_ID") + @OneToOne + private TipoIdentificacion tipoIdentificacion; + + @Column(name = "NUMIDENTIFICACION") + private String numIdentidicacion; + + @Column(name = "DESCNOMBRE") + private String descNombre; + + @Column(name = "DESCAPELLIDOS") + private String descApellidos; + + @Column(name = "DESCDIRECCION") + private String descDireccion; + + @Column(name = "DESCTELEFONO") + private String descTelefono; + + @Column(name = "DESCEMAIL") + private String descEmail; + + @Column(name = "INDVIAJEREDONDO") + private Boolean indViajeRedondo; + + @Column(name = "FECHORIDA") + private Date fechaHoraIda; + + @Column(name = "DESCOBSERVACIONIDA") + private String descObservacionIda; + + @Column(name = "DESCSITIOPARTIDAIDA") + private String descSitioPartidaIda; + + @Column(name = "DESCSITIOLLEGADAIDA") + private String descSitioLlegadaIda; + + @Column(name = "FECHORREGRESO") + private Date fechaHoraRegreso; + + @Column(name = "DESCOBSERVACIONREGRESO") + private String descObservacionRegreso; + + @Column(name = "DESCSITIOPARTIDAREGRESO") + private String descSitioPartidaRegreso; + + @Column(name = "DESCSITIOLLEGADAREGRESO") + private String descSitioLlegadaRegreso; + + @Column(name = "INDREQUIEREDISPVEHICULO") + private Integer indRequiereDispVehiculo; + + @Column(name = "INDREQUIERERECORRIDOSINTERNOS") + private Integer indRequiereRecorridosInternos; + + @Column(name = "STATUSSOLICITUDEXPRESO_ID") + private Integer statusSolicitudExpresoId; + + @Lob + @Column(name = "DOCCOTIZACION", columnDefinition="BLOB") + private byte[] docCotizacion; + + @Lob + @Column(name = "DOCCONTRATO", columnDefinition="BLOB") + private byte[] docContrato; + + @Column(name = "VALORCOTIZACION") + private Integer valorCotizacion; + + @Column(name = "FORMAPAGO_ID") + private Integer formaPagoId; + + @Column(name = "USUARIOAUTORIZACREDITO") + private Integer usuarioAutorizaCredito; + + @Column(name = "FECHORAUTORIZACREDITO") + @Temporal(TemporalType.TIMESTAMP) + private Date fechaHoraAutorizaCredito; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fechaHoraModif; + + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public Integer getSolicitudExpresoId() { + return solicitudExpresoId; + } + + public void setSolicitudExpresoId(Integer solicitudExpresoId) { + this.solicitudExpresoId = solicitudExpresoId; + } + + public Ciudad getCiudadOrigen() { + return ciudadOrigen; + } + + public void setCiudadOrigen(Ciudad ciudadOrigen) { + this.ciudadOrigen = ciudadOrigen; + } + + public Ciudad getCiudadDestino() { + return ciudadDestino; + } + + public void setCiudadDestino(Ciudad ciudadDestino) { + this.ciudadDestino = ciudadDestino; + } + + public Integer getCantidadPasajeros() { + return cantidadPasajeros; + } + + public void setCantidadPasajeros(Integer cantidadPasajeros) { + this.cantidadPasajeros = cantidadPasajeros; + } + + public Date getFechaSolicitud() { + return fechaSolicitud; + } + + public void setFechaSolicitud(Date fechaSolicitud) { + this.fechaSolicitud = fechaSolicitud; + } + + public TipoIdentificacion getTipoIdentificacion() { + return tipoIdentificacion; + } + + public void setTipoIdentificacion(TipoIdentificacion tipoIdentificacion) { + this.tipoIdentificacion = tipoIdentificacion; + } + + public String getNumIdentidicacion() { + return numIdentidicacion; + } + + public void setNumIdentidicacion(String numIdentidicacion) { + this.numIdentidicacion = numIdentidicacion; + } + + public String getDescNombre() { + return descNombre; + } + + public void setDescNombre(String descNombre) { + this.descNombre = descNombre; + } + + public String getDescApellidos() { + return descApellidos; + } + + public void setDescApellidos(String descApellidos) { + this.descApellidos = descApellidos; + } + + public String getDescDireccion() { + return descDireccion; + } + + public void setDescDireccion(String descDireccion) { + this.descDireccion = descDireccion; + } + + public String getDescTelefono() { + return descTelefono; + } + + public void setDescTelefono(String descTelefono) { + this.descTelefono = descTelefono; + } + + public String getDescEmail() { + return descEmail; + } + + public void setDescEmail(String descEmail) { + this.descEmail = descEmail; + } + + public Boolean getIndViajeRedondo() { + return indViajeRedondo; + } + + public void setIndViajeRedondo(Boolean indViajeRedondo) { + this.indViajeRedondo = indViajeRedondo; + } + + public Date getFechaHoraIda() { + return fechaHoraIda; + } + + public void setFechaHoraIda(Date fechaHoraIda) { + this.fechaHoraIda = fechaHoraIda; + } + + public String getDescObservacionIda() { + return descObservacionIda; + } + + public void setDescObservacionIda(String descObservacionIda) { + this.descObservacionIda = descObservacionIda; + } + + public String getDescSitioPartidaIda() { + return descSitioPartidaIda; + } + + public void setDescSitioPartidaIda(String descSitioPartidaIda) { + this.descSitioPartidaIda = descSitioPartidaIda; + } + + public String getDescSitioLlegadaIda() { + return descSitioLlegadaIda; + } + + public void setDescSitioLlegadaIda(String descSitioLlegadaIda) { + this.descSitioLlegadaIda = descSitioLlegadaIda; + } + + public Date getFechaHoraRegreso() { + return fechaHoraRegreso; + } + + public void setFechaHoraRegreso(Date fechaHoraRegreso) { + this.fechaHoraRegreso = fechaHoraRegreso; + } + + public String getDescObservacionRegreso() { + return descObservacionRegreso; + } + + public void setDescObservacionRegreso(String descObservacionRegreso) { + this.descObservacionRegreso = descObservacionRegreso; + } + + public String getDescSitioPartidaRegreso() { + return descSitioPartidaRegreso; + } + + public void setDescSitioPartidaRegreso(String descSitioPartidaRegreso) { + this.descSitioPartidaRegreso = descSitioPartidaRegreso; + } + + public String getDescSitioLlegadaRegreso() { + return descSitioLlegadaRegreso; + } + + public void setDescSitioLlegadaRegreso(String descSitioLlegadaRegreso) { + this.descSitioLlegadaRegreso = descSitioLlegadaRegreso; + } + + public Integer getIndRequiereDispVehiculo() { + return indRequiereDispVehiculo; + } + + public void setIndRequiereDispVehiculo(Integer indRequiereDispVehiculo) { + this.indRequiereDispVehiculo = indRequiereDispVehiculo; + } + + public Integer getIndRequiereRecorridosInternos() { + return indRequiereRecorridosInternos; + } + + public void setIndRequiereRecorridosInternos(Integer indRequiereRecorridosInternos) { + this.indRequiereRecorridosInternos = indRequiereRecorridosInternos; + } + + public Integer getStatusSolicitudExpresoId() { + return statusSolicitudExpresoId; + } + + public void setStatusSolicitudExpresoId(Integer statusSolicitudExpresoId) { + this.statusSolicitudExpresoId = statusSolicitudExpresoId; + } + + public byte[] getDocCotizacion() { + return docCotizacion; + } + + public void setDocCotizacion(byte[] docCotizacion) { + this.docCotizacion = docCotizacion; + } + + public byte[] getDocContrato() { + return docContrato; + } + + public void setDocContrato(byte[] docContrato) { + this.docContrato = docContrato; + } + + public Integer getValorCotizacion() { + return valorCotizacion; + } + + public void setValorCotizacion(Integer valorCotizacion) { + this.valorCotizacion = valorCotizacion; + } + + public Integer getFormaPagoId() { + return formaPagoId; + } + + public void setFormaPagoId(Integer formaPagoId) { + this.formaPagoId = formaPagoId; + } + + public Integer getUsuarioAutorizaCredito() { + return usuarioAutorizaCredito; + } + + public void setUsuarioAutorizaCredito(Integer usuarioAutorizaCredito) { + this.usuarioAutorizaCredito = usuarioAutorizaCredito; + } + + public Date getFechaHoraAutorizaCredito() { + return fechaHoraAutorizaCredito; + } + + public void setFechaHoraAutorizaCredito(Date fechaHoraAutorizaCredito) { + this.fechaHoraAutorizaCredito = fechaHoraAutorizaCredito; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFechaHoraModif() { + return fechaHoraModif; + } + + public void setFechaHoraModif(Date fechaHoraModif) { + this.fechaHoraModif = fechaHoraModif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public String toString() { + return "SolicitudExpreso [solicitudExpresoId=" + solicitudExpresoId + ", ciudadOrigen=" + ciudadOrigen + + ", ciudadDestino=" + ciudadDestino + ", cantidadPasajeros=" + cantidadPasajeros + ", fechaSolicitud=" + + fechaSolicitud + ", tipoIdentificacion=" + tipoIdentificacion + ", numIdentidicacion=" + + numIdentidicacion + ", descNombre=" + descNombre + ", descApellidos=" + descApellidos + + ", descDireccion=" + descDireccion + ", descTelefono=" + descTelefono + ", descEmail=" + descEmail + + ", indViajeRedondo=" + indViajeRedondo + ", fechaHoraIda=" + fechaHoraIda + ", descObservacionIda=" + + descObservacionIda + ", descSitioPartidaIda=" + descSitioPartidaIda + ", descSitioLlegadaIda=" + + descSitioLlegadaIda + ", fechaHoraRegreso=" + fechaHoraRegreso + ", descObservacionRegreso=" + + descObservacionRegreso + ", descSitioPartidaRegreso=" + descSitioPartidaRegreso + + ", descSitioLlegadaRegreso=" + descSitioLlegadaRegreso + ", indRequiereDispVehiculo=" + + indRequiereDispVehiculo + ", indRequiereRecorridosInternos=" + indRequiereRecorridosInternos + + ", statusSolicitudExpresoId=" + statusSolicitudExpresoId + ", docCotizacion=" + + Arrays.toString(docCotizacion) + ", docContrato=" + Arrays.toString(docContrato) + + ", valorCotizacion=" + valorCotizacion + ", formaPagoId=" + formaPagoId + ", usuarioAutorizaCredito=" + + usuarioAutorizaCredito + ", fechaHoraAutorizaCredito=" + fechaHoraAutorizaCredito + ", activo=" + + activo + ", fechaHoraModif=" + fechaHoraModif + ", usuarioId=" + usuarioId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/Transportadora.java b/src/com/rjconsultores/ventaboletos/entidad/Transportadora.java index b56f83f9d..7faaee1cc 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/Transportadora.java +++ b/src/com/rjconsultores/ventaboletos/entidad/Transportadora.java @@ -61,5 +61,13 @@ public class Transportadora implements Serializable{ @Column(name = "FECMODIF") @Temporal(TemporalType.TIMESTAMP) private Date fecModif; - + + @Override + public String toString() { + return nomeTransportadora; + } + + public Transportadora(String nomeTransportadora) { + this.nomeTransportadora = nomeTransportadora; + } } \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/entidad/TrayectosExpresos.java b/src/com/rjconsultores/ventaboletos/entidad/TrayectosExpresos.java new file mode 100644 index 000000000..7c6496006 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/TrayectosExpresos.java @@ -0,0 +1,152 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.util.Arrays; +import java.util.Date; + +import javax.persistence.Basic; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.Lob; +import javax.persistence.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +@Entity +@SequenceGenerator(name = "TRAYECTOS_EXPRESO_SEQ", sequenceName = "TRAYECTOS_EXPRESO_SEQ", allocationSize = 1) +@Table(name = "TRAYECTOS_EXPRESOS") +public class TrayectosExpresos implements Serializable{ + + private static final long serialVersionUID = 1L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "TRAYECTOS_EXPRESO_SEQ") + @Column(name = "TRAYECTOSEXPRESOS_ID") + private Integer trayectoExpresoId; + + @JoinColumn(name = "SOLICITUDEXPRESO_ID") + @OneToOne + private SolicitudExpreso solicitudExpresoId; + + @Column(name = "DESCTRAYECTO") + private String descTrayecto; + + @Column(name = "VALORTRAYECTO") + private Integer valorTrayecto; + + @Column(name = "CANTVEHICULOS") + private Integer cantVehiculos; + + @Column(name = "NUMPLACA") + private String numPlaca; + + @Lob + @Column(name = "DOCFLUEC", columnDefinition="BLOB") + private byte[] docFluec; + + @Column(name = "ACTIVO") + private Boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fechaHoraModif; + + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + public Integer getTrayectoExpresoId() { + return trayectoExpresoId; + } + + public void setTrayectoExpresoId(Integer trayectoExpresoId) { + this.trayectoExpresoId = trayectoExpresoId; + } + + public SolicitudExpreso getSolicitudExpresoId() { + return solicitudExpresoId; + } + + public void setSolicitudExpresoId(SolicitudExpreso solicitudExpresoId) { + this.solicitudExpresoId = solicitudExpresoId; + } + + public String getDescTrayecto() { + return descTrayecto; + } + + public void setDescTrayecto(String descTrayecto) { + this.descTrayecto = descTrayecto; + } + + public Integer getValorTrayecto() { + return valorTrayecto; + } + + public void setValorTrayecto(Integer valorTrayecto) { + this.valorTrayecto = valorTrayecto; + } + + public Integer getCantVehiculos() { + return cantVehiculos; + } + + public void setCantVehiculos(Integer cantVehiculos) { + this.cantVehiculos = cantVehiculos; + } + + public String getNumPlaca() { + return numPlaca; + } + + public void setNumPlaca(String numPlaca) { + this.numPlaca = numPlaca; + } + + public byte[] getDocFluec() { + return docFluec; + } + + public void setDocFluec(byte[] docFluec) { + this.docFluec = docFluec; + } + + public Boolean getActivo() { + return activo; + } + + public void setActivo(Boolean activo) { + this.activo = activo; + } + + public Date getFechaHoraModif() { + return fechaHoraModif; + } + + public void setFechaHoraModif(Date fechaHoraModif) { + this.fechaHoraModif = fechaHoraModif; + } + + public Integer getUsuarioId() { + return usuarioId; + } + + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } + + @Override + public String toString() { + return "TrayectosExpresos [trayectoExpresoId=" + trayectoExpresoId + ", solicitudExpresoId=" + + solicitudExpresoId + ", descTrayecto=" + descTrayecto + ", valorTrayecto=" + valorTrayecto + + ", cantVehiculos=" + cantVehiculos + ", numPlaca=" + numPlaca + ", docFluec=" + + Arrays.toString(docFluec) + ", activo=" + activo + ", fechaHoraModif=" + fechaHoraModif + + ", usuarioId=" + usuarioId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/Voucher.java b/src/com/rjconsultores/ventaboletos/entidad/Voucher.java new file mode 100644 index 000000000..5c41f4300 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/Voucher.java @@ -0,0 +1,144 @@ +package com.rjconsultores.ventaboletos.entidad; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +import javax.persistence.Basic; +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.OneToOne; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.Transient; + +import com.rjconsultores.ventaboletos.anotacao.Renderizado; +import com.rjconsultores.ventaboletos.enums.SituacaoVoucher; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import lombok.Setter; + +@Getter +@Setter +@AllArgsConstructor +@NoArgsConstructor +@Entity +@SequenceGenerator(name = "VOUCHER_SEQ", sequenceName = "VOUCHER_SEQ", allocationSize = 1) +@Table(name = "VOUCHER") +public class Voucher implements Serializable { + + private static final long serialVersionUID = -3684489881654368314L; + + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "VOUCHER_SEQ") + @Renderizado( posicao = 1) + @Column(name = "VOUCHER_ID") + private Long voucherId; + + @OneToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "CONTRATO_ID") + @Renderizado( posicao = 2) + private ContratoCorporativo contrato; + + @Column(name = "NOME_PASSAGEIRO", length = 150) + private String nomePassageiro; + + @Column(name = "NUM_FATURA", length = 30) + private String numFatura; + + @Column(name = "VALOR_LICITADO") + @Renderizado( posicao = 5 ) + private BigDecimal valorLicitado; + + @Renderizado( posicao = 6) + @Column(name = "VALOR_LEGALIZADO") + private BigDecimal valorLegalizado; + + @Renderizado( posicao = 4) + @Column(name = "DATA_VALIDADE") + private Date dataValidade; + + @Column(name = "DATA_INCLUSAO") + @Temporal(TemporalType.TIMESTAMP) + private Date dataInclusao; + + @Column(name = "ORIGEN_ID") + private Integer origenId; + + @Column(name = "DESTINO_ID") + private Integer destinoId; + + @Column(name = "CLASESERVICIO_ID") + private Long claseServicioId; + + @Column(name = "STATUS") + @Renderizado( conversor = SituacaoVoucher.class, posicao = 3) + private Integer status; + + @Column(name = "CLIENTECORPORATIVO_ID") + private Long clienteCorporativoId; + + @Column(name = "MOTIVOCANCELACION_ID") + private Long motivoCancelacionId; + + @Column(name = "GRUPOCONTRATO_ID") + private Long grupoContratoId; + + @OneToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "TRANSPORTADORA_ID") + private Transportadora transportadora; + + @Column(name = "ACTIVO") + private boolean activo; + + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecModif; + + @Column(name = "USUARIO_ID") + private Integer usuarioId; + + @Transient + @Renderizado( posicao = 7 ) + private transient String descOrigem; + + @Transient + @Renderizado( posicao = 8 ) + private String descDestino; + + public SituacaoVoucher getSituacaoVoucher() { + return SituacaoVoucher.buscarPeloValor(status); + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + + if (getClass() != obj.getClass()) { + return false; + } + + final Voucher other = (Voucher) obj; + return this.getVoucherId().equals(other.getVoucherId()); + } + + @Override + public int hashCode() { + int hash = 7; + hash = 59 * hash + (this.getVoucherId() != null ? this.getVoucherId().hashCode() : 0); + return hash; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/enums/EnumClasseServicoConfortoMonitrip.java b/src/com/rjconsultores/ventaboletos/enums/EnumClasseServicoConfortoMonitrip.java new file mode 100644 index 000000000..65779180b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/enums/EnumClasseServicoConfortoMonitrip.java @@ -0,0 +1,52 @@ +package com.rjconsultores.ventaboletos.enums; + +import java.util.Arrays; +import java.util.List; + +import org.zkoss.util.resource.Labels; + +public enum EnumClasseServicoConfortoMonitrip { + + CAMA(1, Labels.getLabel("editarAliasServicoController.tipoClasseConfortoMonitrip.cama")), + LEITO(2, Labels.getLabel("editarAliasServicoController.tipoClasseConfortoMonitrip.leito")), + SEMILEITO(3, Labels.getLabel("editarAliasServicoController.tipoClasseConfortoMonitrip.semileito")), + EXECUTIVA(4, Labels.getLabel("editarAliasServicoController.tipoClasseConfortoMonitrip.executiva")), + BASICA(5, Labels.getLabel("editarAliasServicoController.tipoClasseConfortoMonitrip.basica")); + + + private Integer codigo; + private String descricao; + + private EnumClasseServicoConfortoMonitrip(Integer codigo, String descricao) { + this.codigo = codigo; + this.descricao = descricao; + } + + public Integer getCodigo() { + return codigo; + } + + public String getDescricao() { + return descricao; + } + + @Override + public String toString() { + return getDescricao(); + } + + public static List getList() { + return Arrays.asList(EnumClasseServicoConfortoMonitrip.values()); + } + + public static EnumClasseServicoConfortoMonitrip getTipo(Integer codigo) { + + for (EnumClasseServicoConfortoMonitrip tipoClasseServicoBPe : EnumClasseServicoConfortoMonitrip.values()) { + if(tipoClasseServicoBPe.getCodigo().equals(codigo)) { + return tipoClasseServicoBPe; + } + } + return null; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/enums/SituacaoVoucher.java b/src/com/rjconsultores/ventaboletos/enums/SituacaoVoucher.java new file mode 100644 index 000000000..063cfdd97 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/enums/SituacaoVoucher.java @@ -0,0 +1,47 @@ +package com.rjconsultores.ventaboletos.enums; + +import org.zkoss.util.resource.Labels; + +public enum SituacaoVoucher { + + EMITIDO(0,Labels.getLabel("label.situacaoVoucher.emitido")), + LEGALIZADO(1,Labels.getLabel("label.situacaoVoucher.legalizado")), + FATURADO(2,Labels.getLabel("label.situacaoVoucher.faturado")), + CANCELADO(3,Labels.getLabel("label.situacaoVoucher.cancelado")), + ; + + private Integer valor; + private String descricao; + + private SituacaoVoucher(Integer valor, String descricao) { + this.valor = valor; + this.descricao = descricao; + } + + public String getDescricao() { + return descricao; + } + + @Override + public String toString() { + return getDescricao(); + } + + public Integer getValor() { + return valor; + } + + public static SituacaoVoucher buscarPeloValor(Integer valor) { + + for (SituacaoVoucher tipo : SituacaoVoucher.values()) { + if (tipo.getValor().equals(valor)) { + return tipo; + } + } + return null; + } + + public static SituacaoVoucher buscarPeloValor(String valor) { + return buscarPeloValor( Integer.valueOf(valor)); + } +} diff --git a/src/com/rjconsultores/ventaboletos/enums/TipoLancamentoCaixa.java b/src/com/rjconsultores/ventaboletos/enums/TipoLancamentoCaixa.java index ad52b132b..429f505fa 100644 --- a/src/com/rjconsultores/ventaboletos/enums/TipoLancamentoCaixa.java +++ b/src/com/rjconsultores/ventaboletos/enums/TipoLancamentoCaixa.java @@ -11,6 +11,7 @@ public enum TipoLancamentoCaixa { BILHETE_CONFIRMADO(4,Labels.getLabel("label.tipoLancamento.bilheteConfirmado"), false), BILHETE_ABERTO(5,Labels.getLabel("label.tipoLancamento.bilheteAberto"), false), EVENTO_EXTRA(6,Labels.getLabel("label.tipoLancamento.eventoExtra"), false), + VOUCHER(7,Labels.getLabel("label.tipoLancamento.voucher"), false), ; private Integer valor; diff --git a/src/com/rjconsultores/ventaboletos/exception/ValidacaoRemessaException.java b/src/com/rjconsultores/ventaboletos/exception/ValidacaoRemessaException.java index 8c780e7bb..a55ded6ee 100644 --- a/src/com/rjconsultores/ventaboletos/exception/ValidacaoRemessaException.java +++ b/src/com/rjconsultores/ventaboletos/exception/ValidacaoRemessaException.java @@ -1,5 +1,9 @@ package com.rjconsultores.ventaboletos.exception; +import java.text.MessageFormat; + +import org.zkoss.util.resource.Labels; + public class ValidacaoRemessaException extends RuntimeException { private static final long serialVersionUID = -919934943159729995L; @@ -7,5 +11,9 @@ public class ValidacaoRemessaException extends RuntimeException { public ValidacaoRemessaException(String message) { super(message); } + + public ValidacaoRemessaException(String message, Object oMsg, Object... parametros) { + super(new MessageFormat(Labels.getLabel(message, parametros)).format(oMsg)); + } } diff --git a/src/com/rjconsultores/ventaboletos/service/ConvenioTransportadoraService.java b/src/com/rjconsultores/ventaboletos/service/ConvenioTransportadoraService.java index f6496db1f..b4978c2f1 100644 --- a/src/com/rjconsultores/ventaboletos/service/ConvenioTransportadoraService.java +++ b/src/com/rjconsultores/ventaboletos/service/ConvenioTransportadoraService.java @@ -8,7 +8,7 @@ import com.rjconsultores.ventaboletos.exception.BusinessException; public interface ConvenioTransportadoraService extends GenericService { - ConvenioTransportadora buscarPelaTransportadoraId(Long transportadoraId); + public ConvenioTransportadora buscarPelaTransportadoraId(Long transportadoraId); public ConvenioTransportadora suscribirActualizar(ConvenioTransportadora convenio) throws BusinessException; diff --git a/src/com/rjconsultores/ventaboletos/service/RutaService.java b/src/com/rjconsultores/ventaboletos/service/RutaService.java index 8671780a0..5065b8a42 100644 --- a/src/com/rjconsultores/ventaboletos/service/RutaService.java +++ b/src/com/rjconsultores/ventaboletos/service/RutaService.java @@ -128,4 +128,7 @@ public interface RutaService { public List buscarPorOrgaoEcasetaPeaje(OrgaoConcedente orgao, Integer[] listCasetaPeaje, Empresa empresa); + public List buscarRutasPorEmpresaOrgaoConcedenteClaseServicio(Empresa empresa, OrgaoConcedente orgao, ClaseServicio claseServicio); + + } diff --git a/src/com/rjconsultores/ventaboletos/service/SolicitudExpresosService.java b/src/com/rjconsultores/ventaboletos/service/SolicitudExpresosService.java new file mode 100644 index 000000000..0a399160e --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/SolicitudExpresosService.java @@ -0,0 +1,8 @@ +package com.rjconsultores.ventaboletos.service; + +import com.rjconsultores.ventaboletos.entidad.SolicitudExpreso; +import com.rjconsultores.ventaboletos.entidad.TrayectosExpresos; + +public interface SolicitudExpresosService extends GenericService{ + +} diff --git a/src/com/rjconsultores/ventaboletos/service/TrayectosExpresosService.java b/src/com/rjconsultores/ventaboletos/service/TrayectosExpresosService.java new file mode 100644 index 000000000..35a2e82b6 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/TrayectosExpresosService.java @@ -0,0 +1,12 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.CorridaTramo; +import com.rjconsultores.ventaboletos.entidad.SolicitudExpreso; +import com.rjconsultores.ventaboletos.entidad.TrayectosExpresos; + +public interface TrayectosExpresosService extends GenericService{ + + List obtenerTrayectosPorServicioId(SolicitudExpreso expreso); +} diff --git a/src/com/rjconsultores/ventaboletos/service/VoucherService.java b/src/com/rjconsultores/ventaboletos/service/VoucherService.java new file mode 100644 index 000000000..83942c652 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/VoucherService.java @@ -0,0 +1,12 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.Date; +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.Voucher; + +public interface VoucherService extends GenericService { + + List buscarConsulta(Long voucherId, String numContrato, String nit, String nomeTransportadora, Date dataInicial, Date dataFinal, Integer origemId, Integer destinoId); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/RutaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/RutaServiceImpl.java index 4fc8cf097..c6d761014 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/RutaServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/RutaServiceImpl.java @@ -620,6 +620,11 @@ public class RutaServiceImpl implements RutaService { public List buscarRutasPorEmpresaOrgaoConcedente(Empresa empresa, OrgaoConcedente orgao) { return rutaDAO.buscarRutasPorEmpresaOrgaoConcedente(empresa, orgao); } + + @Override + public List buscarRutasPorEmpresaOrgaoConcedenteClaseServicio(Empresa empresa, OrgaoConcedente orgao, ClaseServicio claseServicio) { + return rutaDAO.buscarRutasPorEmpresaOrgaoConcedenteClaseServicio(empresa, orgao, claseServicio); + } class CambioRutaTramo { private Tramo viejoTramo; diff --git a/src/com/rjconsultores/ventaboletos/service/impl/SolicitudExpresosServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/SolicitudExpresosServiceImpl.java new file mode 100644 index 000000000..4318f3094 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/SolicitudExpresosServiceImpl.java @@ -0,0 +1,53 @@ +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 org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.SolicitudExpresosDAO; +import com.rjconsultores.ventaboletos.dao.TrayectosExpresosDAO; +import com.rjconsultores.ventaboletos.entidad.SolicitudExpreso; +import com.rjconsultores.ventaboletos.entidad.TrayectosExpresos; +import com.rjconsultores.ventaboletos.service.SolicitudExpresosService; + +@Service("solicitudExpresosService") +public class SolicitudExpresosServiceImpl implements SolicitudExpresosService{ + + @Autowired + private SolicitudExpresosDAO solicitudExpresosDAO; + + @Override + public List obtenerTodos() { + // TODO Auto-generated method stub + return null; + } + + @Override + public SolicitudExpreso obtenerID(Integer id) { + // TODO Auto-generated method stub + return null; + } + + @Override + public SolicitudExpreso suscribir(SolicitudExpreso entidad) { + // TODO Auto-generated method stub + return null; + } + + @Transactional + public SolicitudExpreso actualizacion(SolicitudExpreso entidad) { + + entidad.setFechaHoraModif(Calendar.getInstance().getTime()); + return solicitudExpresosDAO.actualizacion(entidad); + } + + @Override + public void borrar(SolicitudExpreso entidad) { + // TODO Auto-generated method stub + + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/TrayectosExpresosServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/TrayectosExpresosServiceImpl.java new file mode 100644 index 000000000..f47b11988 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/TrayectosExpresosServiceImpl.java @@ -0,0 +1,59 @@ +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 org.springframework.transaction.annotation.Transactional; + +import com.rjconsultores.ventaboletos.dao.TarjetaViajeDAO; +import com.rjconsultores.ventaboletos.dao.TrayectosExpresosDAO; +import com.rjconsultores.ventaboletos.entidad.SolicitudExpreso; +import com.rjconsultores.ventaboletos.entidad.TrayectosExpresos; +import com.rjconsultores.ventaboletos.service.TrayectosExpresosService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("trayectosExpresosService") +public class TrayectosExpresosServiceImpl implements TrayectosExpresosService{ + + @Autowired + private TrayectosExpresosDAO trayectosExpresosDAO; + + @Override + public List obtenerTodos() { + return trayectosExpresosDAO.obtenerTodos(); + } + + @Override + public TrayectosExpresos obtenerID(Integer id) { + return trayectosExpresosDAO.obtenerID(id); + } + + @Transactional + public TrayectosExpresos suscribir(TrayectosExpresos entidad) { + entidad.setActivo(true); + entidad.setFechaHoraModif(Calendar.getInstance().getTime()); + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + return trayectosExpresosDAO.suscribir(entidad); + } + + @Transactional + public TrayectosExpresos actualizacion(TrayectosExpresos entidad) { + entidad.setFechaHoraModif(Calendar.getInstance().getTime()); + return trayectosExpresosDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(TrayectosExpresos entidad) { + entidad.setFechaHoraModif(Calendar.getInstance().getTime()); + entidad.setActivo(false); + trayectosExpresosDAO.actualizacion(entidad); + } + + @Override + public List obtenerTrayectosPorServicioId(SolicitudExpreso expreso) { + return trayectosExpresosDAO.obtenerTrayectosPorServicioId(expreso); + } + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/VoucherServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/VoucherServiceImpl.java new file mode 100644 index 000000000..e23f380e2 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/VoucherServiceImpl.java @@ -0,0 +1,75 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.rjconsultores.ventaboletos.service.impl; + +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.VoucherDAO; +import com.rjconsultores.ventaboletos.entidad.Voucher; +import com.rjconsultores.ventaboletos.service.VoucherService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + +@Service("voucherService") +public class VoucherServiceImpl implements VoucherService { + + @Autowired + private VoucherDAO voucherDAO; + + public List obtenerTodos() { + return voucherDAO.obtenerTodos(); + } + + public Voucher obtenerID(Long id) { + return voucherDAO.obtenerID(id); + } + + @Transactional + public Voucher suscribir(Voucher entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecModif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + return voucherDAO.suscribir(entidad); + } + + @Transactional + public Voucher actualizacion(Voucher entidad) { + return voucherDAO.actualizacion(entidad); + } + + @Transactional + public void borrar(Voucher entidad) { + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecModif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.FALSE); + + voucherDAO.actualizacion(entidad); + } + + @Override + public List buscarConsulta(Long voucherId, + String numContrato, + String nit, + String nomeTransportadora, + Date dataInicial, + Date dataFinal, + Integer origemId, + Integer destinoId) { + return voucherDAO.buscarConsulta(voucherId, + numContrato, + nit, + nomeTransportadora, + dataInicial, + dataFinal, + origemId, + destinoId); + } +}