diff --git a/src/com/rjconsultores/routing/MultipleDataSource.java b/src/com/rjconsultores/routing/MultipleDataSource.java index 0d21b5909..1837e1598 100644 --- a/src/com/rjconsultores/routing/MultipleDataSource.java +++ b/src/com/rjconsultores/routing/MultipleDataSource.java @@ -1,7 +1,7 @@ package com.rjconsultores.routing; -import java.sql.SQLFeatureNotSupportedException; import java.util.logging.Logger; + import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource; public class MultipleDataSource extends AbstractRoutingDataSource { @@ -9,8 +9,8 @@ public class MultipleDataSource extends AbstractRoutingDataSource { protected Object determineCurrentLookupKey() { return DynamicDataSourceHolder.getRouteKey(); } - - public Logger getParentLogger() throws SQLFeatureNotSupportedException{ - return null; + + public Logger getParentLogger(){ + return Logger.getLogger("MultipleDataSource"); } } diff --git a/src/com/rjconsultores/ventaboletos/constantes/TipoEventoExtra.java b/src/com/rjconsultores/ventaboletos/constantes/TipoEventoExtra.java index 3915ce346..5bd2fdc6d 100644 --- a/src/com/rjconsultores/ventaboletos/constantes/TipoEventoExtra.java +++ b/src/com/rjconsultores/ventaboletos/constantes/TipoEventoExtra.java @@ -90,6 +90,10 @@ public enum TipoEventoExtra { public String toString() { return "TAXA_CONVENIENCIA_SVI"; } + }, + TARIFA_SAFER{ + public String toString() { + return "TARIFA_SAFER"; + } }; - } diff --git a/src/com/rjconsultores/ventaboletos/dao/ConexionDAO.java b/src/com/rjconsultores/ventaboletos/dao/ConexionDAO.java index 46ad72543..5e258ac4f 100644 --- a/src/com/rjconsultores/ventaboletos/dao/ConexionDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/ConexionDAO.java @@ -14,7 +14,7 @@ public interface ConexionDAO extends GenericDAO { */ public void generarConexiones(Integer usuarioId); - public List buscarConexiones(Integer origenId, Integer destinoId); + public List buscarConexiones(boolean isBuscaAgrupada, Integer origenId, Integer destinoId); public List buscarPorConexionCtrl(Long conexcionCtrlId); diff --git a/src/com/rjconsultores/ventaboletos/dao/ConexionRutaTramoCtrlDAO.java b/src/com/rjconsultores/ventaboletos/dao/ConexionRutaTramoCtrlDAO.java index beb70298b..772b053a2 100644 --- a/src/com/rjconsultores/ventaboletos/dao/ConexionRutaTramoCtrlDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/ConexionRutaTramoCtrlDAO.java @@ -18,6 +18,6 @@ public interface ConexionRutaTramoCtrlDAO extends GenericDAO buscarTodasLocalidadesDestinoC(Integer conexionRutaConfId); - public List buscarPorConexionRutaConf(Integer conexionRutaConfId, char tipo); + public List buscarLocalidadesPorConexionRutaConfAndEixo(Integer conexionRutaConfId, char tipo); } diff --git a/src/com/rjconsultores/ventaboletos/dao/CtrlSerieBPeDAO.java b/src/com/rjconsultores/ventaboletos/dao/CtrlSerieBPeDAO.java index 4000f461e..ce770cc26 100644 --- a/src/com/rjconsultores/ventaboletos/dao/CtrlSerieBPeDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/CtrlSerieBPeDAO.java @@ -6,6 +6,7 @@ public interface CtrlSerieBPeDAO extends GenericDAO { public Boolean gerarSeqSerieBPe(Integer empresaId, String estado, Integer minvalue) throws RuntimeException; public Integer buscarSequencia(Integer empresaId, String estado); + public Integer buscarSerieEmb(Integer empresaId, String estado) throws RuntimeException; public CtrlSerieBPe buscarPorEmpresaEstado(Integer empresaId, Integer estadoId); diff --git a/src/com/rjconsultores/ventaboletos/dao/ParadaDAO.java b/src/com/rjconsultores/ventaboletos/dao/ParadaDAO.java index fd0dfc5ed..fc73b1f36 100644 --- a/src/com/rjconsultores/ventaboletos/dao/ParadaDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/ParadaDAO.java @@ -4,6 +4,7 @@ */ package com.rjconsultores.ventaboletos.dao; +import com.rjconsultores.ventaboletos.entidad.AgrupamentoParada; import com.rjconsultores.ventaboletos.entidad.Ciudad; import com.rjconsultores.ventaboletos.entidad.Nodo; import com.rjconsultores.ventaboletos.entidad.Parada; @@ -56,4 +57,7 @@ public interface ParadaDAO { public List buscarListaPorIds(List paradaIds); public Parada buscarPorId(Integer paradaId); + + public List buscarPorAgrupamentoParadaId(AgrupamentoParada agrupamentoParada); + } diff --git a/src/com/rjconsultores/ventaboletos/dao/SapDAO.java b/src/com/rjconsultores/ventaboletos/dao/SapDAO.java index d9f4c8454..c21e2dc3e 100644 --- a/src/com/rjconsultores/ventaboletos/dao/SapDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/SapDAO.java @@ -11,6 +11,6 @@ public interface SapDAO extends GenericDAO { public List obtenerTodosParaRemessa(Empresa empresa, Date dataDe, Date dataAte, Boolean reenviar); - public boolean atualizaFechamento(Long fechamentocntcorrenteId) throws Exception; + public boolean atualizaFechamento(Long fechamentocntcorrenteId, int status) throws Exception; } \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaDescuentoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaDescuentoHibernateDAO.java index 429da6817..b66deef44 100644 --- a/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaDescuentoHibernateDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/CategoriaDescuentoHibernateDAO.java @@ -58,7 +58,7 @@ public class CategoriaDescuentoHibernateDAO StringBuilder sql = new StringBuilder(); - sql.append(" SELECT coalesce(cd.indnaoaplicatarifaminima, 0) as tarifa "); + sql.append(" SELECT cd.indnaoaplicatarifaminima as tarifa "); sql.append(" from categoria_descuento cd "); sql.append(" inner join categoria_ctrl cc "); sql.append(" on cc.categoriactrl_id = cd.categoriactrl_id "); @@ -66,6 +66,7 @@ public class CategoriaDescuentoHibernateDAO sql.append(" and cc.activo = 1 "); sql.append(" where cd.categoria_id = :categoriaId "); sql.append(" and cd.activo = 1 "); + sql.append(" and cd.indnaoaplicatarifaminima = 1 "); Query query = getSession().createSQLQuery(sql.toString()) .addScalar("tarifa", BooleanType.INSTANCE); @@ -73,8 +74,8 @@ public class CategoriaDescuentoHibernateDAO query.setParameter("empresaId", empresaId ); query.setParameter("categoriaId", categoriaId ); - Boolean retorno = (Boolean)query.uniqueResult(); - - return Boolean.FALSE.equals(retorno); + List retorno = (List)query.list(); + + return retorno !=null && !retorno.isEmpty() && Boolean.TRUE.equals(retorno.get(0)) ? Boolean.TRUE : Boolean.FALSE; } } diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionHibernateDAO.java index 924c92899..de63cb287 100644 --- a/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionHibernateDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionHibernateDAO.java @@ -3,6 +3,7 @@ package com.rjconsultores.ventaboletos.dao.hibernate; import java.math.BigDecimal; import java.util.ArrayList; import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -78,6 +79,9 @@ public class ConexionHibernateDAO extends GenericHibernateDAO conexionVO.setGrupo(((BigDecimal) oc[3]).intValue()); conexionVO.setTramoOrigen((String) oc[4]); conexionVO.setTramoDestino((String) oc[5]); + + conexionVO.setBuscaAgruapada(false); + conexionVOs.add(conexionVO); } @@ -85,11 +89,85 @@ public class ConexionHibernateDAO extends GenericHibernateDAO } @Override - public List buscarConexiones(Integer origenId, Integer destinoId) { + public List buscarConexiones(boolean isBuscaAgrupada, Integer origenId, Integer destinoId) { + + String queryStr = getQueryConexiones(origenId, destinoId); + + Query query = getSession().createSQLQuery(queryStr); + List list = query.list(); + + List vos = new ArrayList(); + for (Object[] o : list) { + ConexionVO vo = new ConexionVO(); + vo.setGrupo(((BigDecimal) o[0]).intValue()); + vo.setConexionCtrlId(((BigDecimal) o[1]).longValue()); + vo.setConOrigen((String) o[2]); + vo.setConDestino((String) o[3]); + vo.setTramoOrigen((String) o[4]); + vo.setTramoDestino((String) o[5]); + vo.setBuscaAgruapada(isBuscaAgrupada); + + vos.add(vo); + } + + if (isBuscaAgrupada) { + return agruparConexiones(vos); + } + + return vos; + } + + private List agruparConexiones(List conexiones) { + + LinkedHashMap> map = new LinkedHashMap>(); + + List agrpVo = new ArrayList(); + + String grupoTrecho = null; + Integer grupo = null; + for (ConexionVO vo : conexiones) { + + if (grupo == null) + grupo = vo.getGrupo(); + + if (!grupo.equals(vo.getGrupo())) { + if (!map.containsKey(grupoTrecho)) { + map.put(grupoTrecho, agrpVo); + } + + grupo = vo.getGrupo(); + grupoTrecho = null; + agrpVo = new ArrayList(); + } + + if (grupo.equals(vo.getGrupo())) { + + if (grupoTrecho == null) { + grupoTrecho = vo.getTramoOrigen() + ";" + vo.getTramoDestino() + ";"; + } else { + grupoTrecho += vo.getTramoOrigen() + ";" + vo.getTramoDestino() + ";"; + } + + agrpVo.add(vo); + } + + } + + List agrupados = new ArrayList(); + for (Map.Entry> entry : map.entrySet()) { + agrupados.addAll(entry.getValue()); + } + + return agrupados; + } + + private String getQueryConexiones(Integer origenId, Integer destinoId) { StringBuilder sb = new StringBuilder(); - sb.append(" select cc.conexionctrl_id as conexionCtrlId, occ.descparada as conOrigen, dcc.descparada as conDestino, "); - sb.append(" c.numgrupo as grupo, oc.descparada as tramoOrigen, dc.descparada as tramoDestino "); + sb.append(" select "); + sb.append(" c.numgrupo as grupo, "); + sb.append(" cc.conexionctrl_id as conexionCtrlId, occ.descparada as conOrigen, dcc.descparada as conDestino, "); + sb.append(" oc.descparada as tramoOrigen, dc.descparada as tramoDestino, c.numsecuencia as numsecuencia "); sb.append(" from conexion_ctrl cc "); sb.append(" inner join conexion_conf conf "); sb.append(" on conf.conexionctrl_id = cc.conexionctrl_id, "); @@ -105,31 +183,17 @@ public class ConexionHibernateDAO extends GenericHibernateDAO sb.append(" and dcc.parada_id = cc.destino_id "); sb.append(" and oc.parada_id = c.origen_id "); sb.append(" and dc.parada_id = c.destino_id "); + if (origenId != null) { - sb.append(" and cc.origen_id = ").append(origenId); + sb.append(" and cc.origen_id = ").append(origenId); } + if (destinoId != null) { - sb.append(" and cc.destino_id = ").append(destinoId); - } - sb.append(" order by occ.descparada, dcc.descparada, cc.conexionctrl_id, c.numgrupo, c.numsecuencia, oc.descparada, dc.descparada "); - - Query query = getSession().createSQLQuery(sb.toString()); - List list = query.list(); - - List vos = new ArrayList(); - for (Object[] o : list) { - ConexionVO vo = new ConexionVO(); - vo.setConexionCtrlId(((BigDecimal) o[0]).longValue()); - vo.setConOrigen((String) o[1]); - vo.setConDestino((String) o[2]); - vo.setGrupo(((BigDecimal) o[3]).intValue()); - vo.setTramoOrigen((String) o[4]); - vo.setTramoDestino((String) o[5]); - - vos.add(vo); + sb.append(" and cc.destino_id = ").append(destinoId); } - return vos; + sb.append(" order by conOrigen, conDestino, conexionCtrlId, grupo, numsecuencia, tramoOrigen, tramoDestino "); + return sb.toString(); } @Override @@ -288,10 +352,10 @@ public class ConexionHibernateDAO extends GenericHibernateDAO @Override public Conexion buscarPorConexionRutaTramoCtrl(Integer conexionRutaTramoId) { - + Criteria c = getSession().createCriteria(getPersistentClass()); c.add(Restrictions.eq("conexionRutaTramoId", conexionRutaTramoId)); - c.add(Restrictions.eq("activo", Boolean.TRUE)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); return (Conexion) c.uniqueResult(); } } diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionRutaTramoCtrlHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionRutaTramoCtrlHibernateDAO.java index 8accbde22..110039032 100644 --- a/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionRutaTramoCtrlHibernateDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionRutaTramoCtrlHibernateDAO.java @@ -116,9 +116,12 @@ public class ConexionRutaTramoCtrlHibernateDAO extends GenericHibernateDAO(paradas); } + /** + *Busca localidades de acordo com o conexionRutaConfId e pelo eixo informado ('A', 'B', 'C') + */ @Override @SuppressWarnings("unchecked") - public List buscarPorConexionRutaConf(Integer conexionRutaConfId, char tipo) { + public List buscarLocalidadesPorConexionRutaConfAndEixo(Integer conexionRutaConfId, char tipo) { String filtro = ""; String join = ""; diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/CorridaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/CorridaHibernateDAO.java index d0cd6ab95..c60e0fbec 100644 --- a/src/com/rjconsultores/ventaboletos/dao/hibernate/CorridaHibernateDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/CorridaHibernateDAO.java @@ -450,11 +450,28 @@ public class CorridaHibernateDAO extends GenericHibernateDAO lsCorridasAux = squery.list(); if (lsCorridasAux != null && !lsCorridasAux.isEmpty()) { diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/CtrlSerieBPeHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/CtrlSerieBPeHibernateDAO.java index ab1625bb8..c07000d23 100644 --- a/src/com/rjconsultores/ventaboletos/dao/hibernate/CtrlSerieBPeHibernateDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/CtrlSerieBPeHibernateDAO.java @@ -72,6 +72,33 @@ public class CtrlSerieBPeHibernateDAO extends GenericHibernateDAO imp return (Parada) c.uniqueResult(); } + + @Override + public List buscarPorAgrupamentoParadaId(AgrupamentoParada agrupamentoParada) { + if(agrupamentoParada !=null && agrupamentoParada.getAgrupamentoParadaId() !=null) { + Criteria c = this.makeCriteria(); + c.add(Restrictions.eq("agrupamentoParada", agrupamentoParada)); + c.add(Restrictions.eq("activo", Boolean.TRUE)); + + return c.list(); + } + return null; + } } diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/RelatorioAgepanHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/RelatorioAgepanHibernateDAO.java index e85f3eaec..050e0d2b7 100644 --- a/src/com/rjconsultores/ventaboletos/dao/hibernate/RelatorioAgepanHibernateDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/RelatorioAgepanHibernateDAO.java @@ -22,7 +22,7 @@ import com.rjconsultores.ventaboletos.vo.OrgaoConcedente.RelatorioGratuidadeAgep @Repository("relatorioAgepanDAO") public class RelatorioAgepanHibernateDAO extends HibernateDaoSupport implements RelatorioAgepanDAO { - public static int ORGAOCONCEDENTE_ID_AGEPAN = 4; +// public static int ORGAOCONCEDENTE_ID_AGEPAN = 4; @Autowired public RelatorioAgepanHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { @@ -45,6 +45,8 @@ public class RelatorioAgepanHibernateDAO extends HibernateDaoSupport implements String tipGratuIds = parametros.get("tipGratuIds").toString(); String linhaIds = parametros.get("linhaIds").toString(); Integer empresa = parametros.get("empresa") != null ? Integer.valueOf(parametros.get("empresa").toString()) : null; + Integer orgaoConcendenteAgepanId = parametros.get("orgaoConcendenteAgepanId") != null ? Integer.valueOf(parametros.get("orgaoConcendenteAgepanId").toString()) : null; + String sQuery = getSql(fecInicioVenda, fecFinalVenda, linhaIds, tipGratuIds, empresa); @@ -73,7 +75,7 @@ public class RelatorioAgepanHibernateDAO extends HibernateDaoSupport implements .setResultTransformer(new AliasToBeanResultTransformer(RelatorioGratuidadeAgepanVO.class)); - qr.setParameter("agepanId", ORGAOCONCEDENTE_ID_AGEPAN); + qr.setParameter("agepanId", orgaoConcendenteAgepanId); qr.setParameter("fecInicioVenda", fecInicioVenda); qr.setParameter("fecFinalVenda", fecFinalVenda); if (empresa != null){ diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/RemessaCNABBancosHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/RemessaCNABBancosHibernateDAO.java index b7cc39179..728199585 100644 --- a/src/com/rjconsultores/ventaboletos/dao/hibernate/RemessaCNABBancosHibernateDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/RemessaCNABBancosHibernateDAO.java @@ -18,7 +18,6 @@ import org.hibernate.Query; import org.hibernate.SessionFactory; import org.hibernate.transform.AliasToBeanResultTransformer; import org.hibernate.type.BooleanType; -import org.hibernate.type.IntegerType; import org.hibernate.type.LongType; import org.hibernate.type.StringType; import org.springframework.beans.factory.annotation.Autowired; @@ -723,7 +722,7 @@ public class RemessaCNABBancosHibernateDAO extends GenericHibernateDAO obtenerTodosParaRemessa(Empresa empresa, Date dataDe, Date dataAte, Boolean reenviar) { @@ -64,9 +65,9 @@ public class SapHibernateDAO extends GenericHibernateDAO 1) "); + sb.append(" AND fc.indintegradosap IS NULL "); } - + sb.append(" ORDER BY "); sb.append(" pv.nombpuntoventa, fc.fecfechamento "); @@ -79,9 +80,10 @@ public class SapHibernateDAO extends GenericHibernateDAO list = query.list(); List retorno = new ArrayList(); @@ -123,7 +125,7 @@ public class SapHibernateDAO extends GenericHibernateDAO { private static final long serialVersionUID = 1L; @Id @@ -50,6 +56,11 @@ public class AliquotaEstadoDestino implements Serializable { @Column(name = "USUARIO_ID") private Integer usuarioId; + + @Transient + @NaoAuditar + private AliquotaEstadoDestino aliquotaEstadoDestinoClone; + @Override @@ -119,5 +130,24 @@ public class AliquotaEstadoDestino implements Serializable { public void setUsuarioId(Integer usuarioId) { this.usuarioId = usuarioId; } + + @Override + public void clonar() throws CloneNotSupportedException { + aliquotaEstadoDestinoClone = new AliquotaEstadoDestino(); + aliquotaEstadoDestinoClone = (AliquotaEstadoDestino) this.clone(); + Hibernate.initialize(aliquotaEstadoDestinoClone.getEmpresaImposto()); + + } + + @Override + public AliquotaEstadoDestino getCloneObject() throws CloneNotSupportedException { + return aliquotaEstadoDestinoClone; + } + + @Override + public String getTextoInclusaoExclusao() { + // TODO Auto-generated method stub + return null; + } } diff --git a/src/com/rjconsultores/ventaboletos/entidad/Categoria.java b/src/com/rjconsultores/ventaboletos/entidad/Categoria.java index 4584e5ae6..584566217 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/Categoria.java +++ b/src/com/rjconsultores/ventaboletos/entidad/Categoria.java @@ -29,6 +29,8 @@ import javax.persistence.TemporalType; import com.rjconsultores.ventaboletos.enums.TipoDescontoBPe; import com.rjconsultores.ventaboletos.enums.TipoDescontoMonitrip; +import br.com.rjconsultores.auditador.annotations.AuditarLista; + /** * * @author Administrador @@ -68,6 +70,7 @@ public class Categoria implements Serializable { private GrupoCategoria grupoCategoria; @OneToMany(mappedBy = "categoria", cascade = CascadeType.ALL) + @AuditarLista(auditarEntidades = true, nome = "Categoria Orgao") private List orgaosConcedentes; @Column(name = "INDCONFERENCIAFISICACOMISSAO") diff --git a/src/com/rjconsultores/ventaboletos/entidad/CategoriaBloqueioImpPosterior.java b/src/com/rjconsultores/ventaboletos/entidad/CategoriaBloqueioImpPosterior.java index 56aca4b8b..6efc6f269 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/CategoriaBloqueioImpPosterior.java +++ b/src/com/rjconsultores/ventaboletos/entidad/CategoriaBloqueioImpPosterior.java @@ -10,11 +10,19 @@ import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.SequenceGenerator; import javax.persistence.Table; +import javax.persistence.Transient; +import org.hibernate.Hibernate; + +import br.com.rjconsultores.auditador.annotations.AuditarClasse; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; + +@AuditarClasse(nome = "CategoriaBloqueioImpPosterior", tela = "Alteração Ponto de Venda/Categoria/Bloqueio/ImpPosterior") @Entity @SequenceGenerator(name = "CAT_BLOQ_IMPPOSTERIOR_SEQ", sequenceName = "CAT_BLOQ_IMPPOSTERIOR_SEQ", allocationSize = 1) @Table(name = "CATEGORIA_BLOQ_IMPPOSTERIOR") -public class CategoriaBloqueioImpPosterior { +public class CategoriaBloqueioImpPosterior implements Auditavel { @Id @Basic(optional = false) @GeneratedValue(strategy = GenerationType.AUTO, generator = "CAT_BLOQ_IMPPOSTERIOR_SEQ") @@ -26,6 +34,11 @@ public class CategoriaBloqueioImpPosterior { @ManyToOne() @JoinColumn(name = "CATEGORIA_ID") private Categoria categoria; + + @Transient + @NaoAuditar + private CategoriaBloqueioImpPosterior categoriaBloqueioImpPosteriorClone; + public Integer getCategoriaBloqueioImpPosteriorId() { return categoriaBloqueioImpPosteriorId; } @@ -65,4 +78,22 @@ public class CategoriaBloqueioImpPosterior { } return true; } + + @Override + public void clonar() throws CloneNotSupportedException { + categoriaBloqueioImpPosteriorClone = new CategoriaBloqueioImpPosterior(); + categoriaBloqueioImpPosteriorClone = (CategoriaBloqueioImpPosterior) this.clone(); + Hibernate.initialize(categoriaBloqueioImpPosteriorClone.getPuntoventa()); + + } + + @Override + public CategoriaBloqueioImpPosterior getCloneObject() throws CloneNotSupportedException { + return categoriaBloqueioImpPosteriorClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getCategoriaBloqueioImpPosteriorId()); + } } diff --git a/src/com/rjconsultores/ventaboletos/entidad/CategoriaOrgao.java b/src/com/rjconsultores/ventaboletos/entidad/CategoriaOrgao.java index 62b23c495..22a294919 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/CategoriaOrgao.java +++ b/src/com/rjconsultores/ventaboletos/entidad/CategoriaOrgao.java @@ -15,11 +15,20 @@ import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import javax.persistence.Transient; +import org.hibernate.Hibernate; + +import br.com.rjconsultores.auditador.annotations.AuditarClasse; +import br.com.rjconsultores.auditador.annotations.AuditarEntidade; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; + +@AuditarClasse(nome = "CategoriaOrgao", tela = "Alteração de Categoria Orgao Concedente") @Entity @SequenceGenerator(name = "CATEGORIA_ORGAO_SEQ", sequenceName = "CATEGORIA_ORGAO_SEQ", allocationSize = 1) @Table(name = "CATEGORIA_ORGAO") -public class CategoriaOrgao implements Serializable { +public class CategoriaOrgao implements Serializable, Auditavel { private static final long serialVersionUID = 1L; @Id @@ -36,10 +45,15 @@ public class CategoriaOrgao implements Serializable { private Integer usuarioId; @JoinColumn(name = "ORGAOCONCEDENTE_ID", referencedColumnName = "ORGAOCONCEDENTE_ID") @ManyToOne + @AuditarEntidade private OrgaoConcedente orgao; @JoinColumn(name = "CATEGORIACTRL_ID", referencedColumnName = "CATEGORIACTRL_ID") @ManyToOne private CategoriaCtrl categoriaCtrl; + + @Transient + @NaoAuditar + private CategoriaOrgao categoriaOrgaoClone; public CategoriaOrgao() { } @@ -130,4 +144,23 @@ public class CategoriaOrgao implements Serializable { public String toString() { return "com.rjconsultores.ventaboletos.entidad.CategoriaOrgao[categoriaorgaoId=" + categoriaorgaoId + "]"; } + + @Override + public void clonar() throws CloneNotSupportedException { + + categoriaOrgaoClone = new CategoriaOrgao(); + categoriaOrgaoClone = (CategoriaOrgao) this.clone(); + Hibernate.initialize(categoriaOrgaoClone.getOrgao()); + + } + + @Override + public CategoriaOrgao getCloneObject() throws CloneNotSupportedException { + return categoriaOrgaoClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getCategoriaorgaoId()); + } } diff --git a/src/com/rjconsultores/ventaboletos/entidad/ClaseServicio.java b/src/com/rjconsultores/ventaboletos/entidad/ClaseServicio.java index 3e7e8aa86..e30c0dd29 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/ClaseServicio.java +++ b/src/com/rjconsultores/ventaboletos/entidad/ClaseServicio.java @@ -13,6 +13,8 @@ import java.util.List; import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Entity; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.OneToMany; @@ -24,6 +26,9 @@ import javax.persistence.Transient; import org.hibernate.annotations.GenericGenerator; +import com.rjconsultores.ventaboletos.enums.TipoClasseServicoBPe; +import com.rjconsultores.ventaboletos.enums.TipoDescontoMonitrip; + import br.com.rjconsultores.auditador.annotations.NaoAuditar; import br.com.rjconsultores.auditador.interfaces.Auditavel; @@ -77,6 +82,10 @@ public class ClaseServicio implements Serializable, Auditavel { @Column(name = "INDNAOVENDESEGUROOPCIONAL") private Boolean indNaoVendeSeguroOpcional; + + @Enumerated(EnumType.STRING) + @Column(name = "desconto_monitrip") + private TipoClasseServicoBPe tipoDescontoMonitrip; @Transient @NaoAuditar @@ -271,4 +280,12 @@ public class ClaseServicio implements Serializable, Auditavel { this.indNaoVendeSeguroOpcional = indNaoVendeSeguroOpcional; } + public TipoClasseServicoBPe getTipoDescontoMonitrip() { + return tipoDescontoMonitrip; + } + + public void setTipoDescontoMonitrip(TipoClasseServicoBPe tipoClasseServicoBPe) { + this.tipoDescontoMonitrip = tipoClasseServicoBPe; + } + } \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/entidad/CobrancaAdcPuntoVenta.java b/src/com/rjconsultores/ventaboletos/entidad/CobrancaAdcPuntoVenta.java index 5a3dfffee..759a6004a 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/CobrancaAdcPuntoVenta.java +++ b/src/com/rjconsultores/ventaboletos/entidad/CobrancaAdcPuntoVenta.java @@ -17,15 +17,23 @@ import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import javax.persistence.Transient; + +import org.hibernate.Hibernate; + +import br.com.rjconsultores.auditador.annotations.AuditarClasse; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; /** * @author vjcor * */ +@AuditarClasse(nome = "CobrancaAdcPuntoVenta", tela = "Alteração Cobrança de Ponto de Venda") @Entity @SequenceGenerator(name = "COBRANCA_ADC_SEQ", sequenceName = "COBRANCA_ADC_SEQ", allocationSize = 1) @Table(name = "COBRANCA_ADC_PUNTO_VENTA") -public class CobrancaAdcPuntoVenta implements Serializable { +public class CobrancaAdcPuntoVenta implements Serializable, Auditavel { private static final long serialVersionUID = 1L; @@ -103,6 +111,10 @@ public class CobrancaAdcPuntoVenta implements Serializable { @Column(name = "USUARIO_ID") private Integer usuarioId; + @Transient + @NaoAuditar + private CobrancaAdcPuntoVenta cobrancaAdcPuntoVentaClone; + private Boolean getBoolean(Boolean valor) { return valor == null ? false : valor; } @@ -315,5 +327,22 @@ public class CobrancaAdcPuntoVenta implements Serializable { return this.getDescricao(); } - + @Override + public void clonar() throws CloneNotSupportedException { + + cobrancaAdcPuntoVentaClone = new CobrancaAdcPuntoVenta(); + cobrancaAdcPuntoVentaClone = (CobrancaAdcPuntoVenta) this.clone(); + Hibernate.initialize(cobrancaAdcPuntoVentaClone.getPuntoVenta()); + + } + + @Override + public CobrancaAdcPuntoVenta getCloneObject() throws CloneNotSupportedException { + return cobrancaAdcPuntoVentaClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getCobrancaAddPuntoVenta_id()); + } } diff --git a/src/com/rjconsultores/ventaboletos/entidad/CoeficienteTarifa.java b/src/com/rjconsultores/ventaboletos/entidad/CoeficienteTarifa.java index b2240a830..74325837f 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/CoeficienteTarifa.java +++ b/src/com/rjconsultores/ventaboletos/entidad/CoeficienteTarifa.java @@ -14,11 +14,17 @@ import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import javax.persistence.Transient; +import br.com.rjconsultores.auditador.annotations.AuditarClasse; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; + +@AuditarClasse(nome = "CoeficienteTarifa", tela = "Alteração de Coeficiente Tarifario") @Entity @SequenceGenerator(name = "COEFICIENTE_TARIFA_SEQ", sequenceName = "COEFICIENTE_TARIFA_SEQ", allocationSize = 1) @Table(name = "COEFICIENTE_TARIFA") -public class CoeficienteTarifa implements Serializable { +public class CoeficienteTarifa implements Serializable, Auditavel { private static final long serialVersionUID = 1L; @Id @@ -37,6 +43,10 @@ public class CoeficienteTarifa implements Serializable { private Date fecmodif; @Column(name = "USUARIO_ID") private Integer usuarioId; + + @Transient + @NaoAuditar + private CoeficienteTarifa coeficienteTarifaClone; public Integer getCoeficienteId() { return coeficienteId; @@ -85,6 +95,23 @@ public class CoeficienteTarifa implements Serializable { public void setUsuarioId(Integer usuarioId) { this.usuarioId = usuarioId; } + + @Override + public CoeficienteTarifa getCloneObject() throws CloneNotSupportedException { + return coeficienteTarifaClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getCoeficienteId()); + } + + @Override + public void clonar() throws CloneNotSupportedException { + coeficienteTarifaClone = new CoeficienteTarifa(); + coeficienteTarifaClone = (CoeficienteTarifa) this.clone(); + + } @Override public String toString() { diff --git a/src/com/rjconsultores/ventaboletos/entidad/Empresa.java b/src/com/rjconsultores/ventaboletos/entidad/Empresa.java index f4ae5d35f..8843eeb74 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/Empresa.java +++ b/src/com/rjconsultores/ventaboletos/entidad/Empresa.java @@ -42,7 +42,7 @@ import br.com.rjconsultores.auditador.interfaces.Auditavel; /** * * @author Rafius - */ + */ @Entity @SequenceGenerator(name = "EMPRESA_SEQ", sequenceName = "EMPRESA_SEQ", allocationSize = 1) @@ -341,9 +341,6 @@ public class Empresa implements Serializable, Auditavel { @Column(name = "INDENVIADADOSAGENCIABPE") private Boolean indEnviaDadosAgenciaBpe; - @Column(name = "INDPRECOPORDEMANDA") - private Boolean indPrecoPorDemanda; - @Column(name = "INDRATEIOCOMISSAOGRUPOLINHA") private Boolean indRateioComissaoGrupoLinha; @@ -396,7 +393,17 @@ public class Empresa implements Serializable, Auditavel { @Column(name = "INDSEGUROOPCIONALW2DIGITAL") private Boolean indSeguroOpcionalW2Digital; + @Column(name = "INDCHECKINBLOQUEADOREMARCACAO") + private Boolean indCheckinBloqueadoRemarcacao; + + @Column(name = "INDAGRUPLOCCONEXAO") + private Boolean indAgrupLocConexao; + + + @Column(name = "INDLIMITACATEGORIAPORCORRIDA") + private Boolean IndLimitaCategoriaPorCorrida; + @Transient @NaoAuditar private Empresa empresaClone; @@ -1287,13 +1294,6 @@ public class Empresa implements Serializable, Auditavel { this.indEnviaDadosAgenciaBpe = indEnviaDadosAgenciaBpe; } - public Boolean getIndPrecoPorDemanda() { - return indPrecoPorDemanda == null ? false : indPrecoPorDemanda; - } - - public void setIndPrecoPorDemanda(Boolean indPrecoPorDemanda) { - this.indPrecoPorDemanda = indPrecoPorDemanda; - } public Boolean getIndRateioComissaoGrupoLinha() { return indRateioComissaoGrupoLinha == null ? false : indRateioComissaoGrupoLinha; @@ -1471,5 +1471,28 @@ public class Empresa implements Serializable, Auditavel { this.indSeguroOpcionalW2Digital = indSeguroOpcionalW2Digital; } + public Boolean getIndCheckinBloqueadoRemarcacao() { + return indCheckinBloqueadoRemarcacao; + } + + public void setIndCheckinBloqueadoRemarcacao(Boolean indCheckinBloqueadoRemarcacao) { + this.indCheckinBloqueadoRemarcacao = indCheckinBloqueadoRemarcacao; + } + public Boolean getIndAgrupLocConexao() { + return indAgrupLocConexao!=null ? indAgrupLocConexao : Boolean.FALSE; + } + + public void setIndAgrupLocConexao(Boolean indAgrupLocConexao) { + this.indAgrupLocConexao = indAgrupLocConexao; + } + + + public Boolean getIndLimitaCategoriaPorCorrida() { + return IndLimitaCategoriaPorCorrida; + } + + public void setIndLimitaCategoriaPorCorrida(Boolean indLimitaCategoriaPorCorrida) { + IndLimitaCategoriaPorCorrida = indLimitaCategoriaPorCorrida; + } } diff --git a/src/com/rjconsultores/ventaboletos/entidad/EmpresaImposto.java b/src/com/rjconsultores/ventaboletos/entidad/EmpresaImposto.java index c9665c24a..18a9b4a22 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/EmpresaImposto.java +++ b/src/com/rjconsultores/ventaboletos/entidad/EmpresaImposto.java @@ -24,11 +24,16 @@ import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import javax.persistence.Transient; + +import br.com.rjconsultores.auditador.annotations.AuditarLista; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; @Entity @SequenceGenerator(name = "EMPRESA_IMPOSTO_SEQ", sequenceName = "EMPRESA_IMPOSTO_SEQ", allocationSize = 1) @Table(name = "EMPRESA_IMPOSTO") -public class EmpresaImposto implements Serializable { +public class EmpresaImposto implements Serializable, Auditavel { private static final long serialVersionUID = 1L; @Id @@ -161,9 +166,13 @@ public class EmpresaImposto implements Serializable { @Column(name = "PORCFECP") private BigDecimal porcFECP; + @Transient + private EmpresaImposto empresaImpostoClone; + @OneToMany(mappedBy = "empresaImposto", cascade = CascadeType.ALL, orphanRemoval=true) + @NaoAuditar private List lsAliquotaEstadoDestino; @@ -819,4 +828,23 @@ public class EmpresaImposto implements Serializable { public void setLsAliquotaEstadoDestino(List lsAliquotaEstadoDestino) { this.lsAliquotaEstadoDestino = lsAliquotaEstadoDestino; } + + @Override + public void clonar() throws CloneNotSupportedException { + + empresaImpostoClone = new EmpresaImposto(); + empresaImpostoClone = (EmpresaImposto) this.clone(); + + + } + + @Override + public EmpresaImposto getCloneObject() throws CloneNotSupportedException { + return empresaImpostoClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getEmpresaImpostoId()); + } } \ 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 f0dc94caa..666513015 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/EsquemaCorrida.java +++ b/src/com/rjconsultores/ventaboletos/entidad/EsquemaCorrida.java @@ -234,6 +234,15 @@ public class EsquemaCorrida implements Serializable, Auditavel { @Column(name = "PLATAFORMASERVICOEXTRA") private String plataformaServicoExtra; + @Column(name = "HORASALIDA_EXTRA") + @Temporal(TemporalType.TIME) + @AuditarAtributo(pattern = "HH:mm") + private Date horasalidaExtra; + + @Column(name = "INDBLOQUEIAWEBAPOSSAIDA") + private Boolean indBloqueiaWebAposSaida; + + public enum GerarFeriado { // Declaração dos enum GERARSEMPRE("GERAR SEMPRE", "S"), @@ -846,4 +855,20 @@ public class EsquemaCorrida implements Serializable, Auditavel { public void setPlataformaServicoExtra(String plataformaServicoExtra) { this.plataformaServicoExtra = plataformaServicoExtra; } + + public Date getHorasalidaExtra() { + return horasalidaExtra; + } + + public void setHorasalidaExtra(Date horasalidaExtra) { + this.horasalidaExtra = horasalidaExtra; + } + + public Boolean getIndBloqueiaWebAposSaida() { + return indBloqueiaWebAposSaida == null ? false : indBloqueiaWebAposSaida; + } + + public void setIndBloqueiaWebAposSaida(Boolean indBloqueiaWebAposSaida) { + this.indBloqueiaWebAposSaida = indBloqueiaWebAposSaida; + } } \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/entidad/FechamentoParamptovta.java b/src/com/rjconsultores/ventaboletos/entidad/FechamentoParamptovta.java index 870c54e12..2bb389a80 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/FechamentoParamptovta.java +++ b/src/com/rjconsultores/ventaboletos/entidad/FechamentoParamptovta.java @@ -14,10 +14,16 @@ import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import javax.persistence.Transient; +import br.com.rjconsultores.auditador.annotations.AuditarClasse; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; + +@AuditarClasse(nome = "FechamentoParamptovta", tela = "Alteração de Ponto de Venda/Fechamento Conta Corrente") @Entity @Table(name = "FECHAMENTO_PARAMPTOVTA") -public class FechamentoParamptovta implements Serializable { +public class FechamentoParamptovta implements Serializable, Auditavel { private static final long serialVersionUID = 1L; @@ -30,6 +36,9 @@ public class FechamentoParamptovta implements Serializable { private Boolean activo; private Integer diasemtransito; private String tipopagamento; + @Transient + @NaoAuditar + private FechamentoParamptovta fechamentoParamptovtaClone; public FechamentoParamptovta() { } @@ -146,7 +155,20 @@ public class FechamentoParamptovta implements Serializable { this.tipopagamento = tipopagamento; } + public void clonar() throws CloneNotSupportedException { + fechamentoParamptovtaClone = new FechamentoParamptovta(); + fechamentoParamptovtaClone = (FechamentoParamptovta) this.clone(); + + } + @Transient + public FechamentoParamptovta getCloneObject() throws CloneNotSupportedException { + return fechamentoParamptovtaClone; + } + @Transient + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getFechamentoparamptovtaId()); + } } diff --git a/src/com/rjconsultores/ventaboletos/entidad/FormaPago.java b/src/com/rjconsultores/ventaboletos/entidad/FormaPago.java index 32ef4d739..9a4b5d103 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/FormaPago.java +++ b/src/com/rjconsultores/ventaboletos/entidad/FormaPago.java @@ -21,20 +21,26 @@ import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import javax.persistence.Transient; import org.hibernate.annotations.GenericGenerator; import com.rjconsultores.ventaboletos.enums.TipoCarteiraDigital; import com.rjconsultores.ventaboletos.enums.TipoFormapago; +import br.com.rjconsultores.auditador.annotations.AuditarClasse; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; + /** * * @author Administrador */ +@AuditarClasse(nome = "Forma Pagamento", tela = "Forma Pagamento") @Entity @SequenceGenerator(name = "FORMA_PAGO_SEQ", sequenceName = "FORMA_PAGO_SEQ", allocationSize = 1) @Table(name = "FORMA_PAGO") -public class FormaPago implements Serializable { +public class FormaPago implements Serializable, Auditavel { private static final long serialVersionUID = 1L; @@ -61,8 +67,10 @@ public class FormaPago implements Serializable { private String cvePago; @Column(name = "IMPFISCAL") private Boolean impfiscal; + @NaoAuditar @OneToMany(mappedBy = "formaPago") private List configRestriccionPagoList; + @NaoAuditar @OneToMany(mappedBy = "formaPago") private List pricingFormapagoList; @Column(name = "INDCONFERENCIAFISICACOMISSAO") @@ -90,6 +98,10 @@ public class FormaPago implements Serializable { @Column(name = "TIPOEVENTOEXTRA_ID") private Long tipoEventoExtraId; + @Transient + @NaoAuditar + private FormaPago formaPagoClone; + public FormaPago() { super(); } @@ -312,4 +324,22 @@ public class FormaPago implements Serializable { public void setTipoEventoExtraId(Long tipoEventoExtraId) { this.tipoEventoExtraId = tipoEventoExtraId; } + + @Override + public FormaPago getCloneObject() throws CloneNotSupportedException { + return formaPagoClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getFormapagoId()); + } + + @Override + public void clonar() throws CloneNotSupportedException { + formaPagoClone = new FormaPago(); + formaPagoClone = (FormaPago) this.clone(); + + } + } diff --git a/src/com/rjconsultores/ventaboletos/entidad/FormaPagoDet.java b/src/com/rjconsultores/ventaboletos/entidad/FormaPagoDet.java index 893b1f596..ed1073907 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/FormaPagoDet.java +++ b/src/com/rjconsultores/ventaboletos/entidad/FormaPagoDet.java @@ -21,15 +21,23 @@ import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import javax.persistence.Transient; + +import org.hibernate.Hibernate; + +import br.com.rjconsultores.auditador.annotations.AuditarClasse; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; /** * * @author Administrador */ +@AuditarClasse(nome = "FormaPagoDet", tela = "Alteração de Forma Pago Detalhe Ponto de Venda") @Entity @SequenceGenerator(name = "FORMA_PAGO_DET_SEQ", sequenceName = "FORMA_PAGO_DET_SEQ", allocationSize = 1) @Table(name = "FORMA_PAGO_DET") -public class FormaPagoDet implements Serializable { +public class FormaPagoDet implements Serializable, Auditavel { private static final long serialVersionUID = 1L; @Id @@ -60,6 +68,9 @@ public class FormaPagoDet implements Serializable { private Boolean indTotalBus; @Column(name = "INDEMBARCADA") private Boolean indEmbarcada; + @Transient + @NaoAuditar + private FormaPagoDet formaPagoDetClone; public FormaPagoDet() { } @@ -179,5 +190,23 @@ public class FormaPagoDet implements Serializable { public void setIndEmbarcada(Boolean indEmbarcada) { this.indEmbarcada = indEmbarcada; } + + @Override + public void clonar() throws CloneNotSupportedException { + formaPagoDetClone = new FormaPagoDet(); + formaPagoDetClone = (FormaPagoDet) this.clone(); + Hibernate.initialize(formaPagoDetClone.getPuntoVenta()); + + } + + @Override + public FormaPagoDet getCloneObject() throws CloneNotSupportedException { + return formaPagoDetClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getFormapagodetId()); + } } diff --git a/src/com/rjconsultores/ventaboletos/entidad/HistoricoPuntoVenta.java b/src/com/rjconsultores/ventaboletos/entidad/HistoricoPuntoVenta.java index 9cf70205a..4870f5a98 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/HistoricoPuntoVenta.java +++ b/src/com/rjconsultores/ventaboletos/entidad/HistoricoPuntoVenta.java @@ -15,11 +15,19 @@ import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import javax.persistence.Transient; +import org.hibernate.Hibernate; + +import br.com.rjconsultores.auditador.annotations.AuditarClasse; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; + +@AuditarClasse(nome = "HistoricoPuntoVenta", tela = "Alteração Ponto de Venda/Historico") @Entity @SequenceGenerator(name = "HIST_PUNTOVENTA_SEQ", sequenceName = "HIST_PUNTOVENTA_SEQ", allocationSize = 1) @Table(name = "HIST_PUNTOVENTA") -public class HistoricoPuntoVenta implements Serializable { +public class HistoricoPuntoVenta implements Serializable, Auditavel { private static final long serialVersionUID = 1L; @Id @@ -35,6 +43,7 @@ public class HistoricoPuntoVenta implements Serializable { @Temporal(TemporalType.TIMESTAMP) private Date fecBloqueio; + @NaoAuditar @ManyToOne @JoinColumn(name = "PUNTOVENTA_ID") private PuntoVenta puntoVenta; @@ -49,6 +58,10 @@ public class HistoricoPuntoVenta implements Serializable { @Column(name = "USUARIO_ID") private Integer usuarioId; + @Transient + @NaoAuditar + private HistoricoPuntoVenta historicoPuntoVentaClone; + public Integer getHistoricoPuntoVentaId() { return historicoPuntoVentaId; } @@ -105,6 +118,24 @@ public class HistoricoPuntoVenta implements Serializable { this.usuarioId = usuarioId; } + @Override + public void clonar() throws CloneNotSupportedException { + historicoPuntoVentaClone = new HistoricoPuntoVenta(); + historicoPuntoVentaClone = (HistoricoPuntoVenta) this.clone(); + Hibernate.initialize(historicoPuntoVentaClone.getPuntoVenta()); + + } + + @Override + public HistoricoPuntoVenta getCloneObject() throws CloneNotSupportedException { + return historicoPuntoVentaClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getHistoricoPuntoVentaId()); + } + } diff --git a/src/com/rjconsultores/ventaboletos/entidad/OCDParam.java b/src/com/rjconsultores/ventaboletos/entidad/OCDParam.java index 55a7d9b45..45483617f 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/OCDParam.java +++ b/src/com/rjconsultores/ventaboletos/entidad/OCDParam.java @@ -49,6 +49,7 @@ public class OCDParam implements java.io.Serializable { private Boolean indOcdDinheiro; private Boolean indtotalbilhete; private Boolean indsempregerarapagar; + private Boolean indOCDPorFormadePagamento; private BigDecimal tiempoLimitePenalizacion; private List listOCDPtoVtaParam; @@ -223,6 +224,16 @@ public class OCDParam implements java.io.Serializable { public void setTiempoLimitePenalizacion(BigDecimal tiempoLimitePenalizacion) { this.tiempoLimitePenalizacion = tiempoLimitePenalizacion; } + + + @Column(name = "INDOCDFORMAPAGAMENTO") + public Boolean getIndOCDPorFormadePagamento() { + return indOCDPorFormadePagamento; + } + + public void setIndOCDPorFormadePagamento(Boolean indOCDPorFormadePagamento) { + this.indOCDPorFormadePagamento = indOCDPorFormadePagamento; + } public OCDPtoVtaParam addOCDPtoVtaParam(OCDPtoVtaParam ocdPtoVtaParam) { OCDPtoVtaParam ocd = new OCDPtoVtaParam(); diff --git a/src/com/rjconsultores/ventaboletos/entidad/OrgaoCancelacion.java b/src/com/rjconsultores/ventaboletos/entidad/OrgaoCancelacion.java index a1dfc64e0..6b71c9f55 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/OrgaoCancelacion.java +++ b/src/com/rjconsultores/ventaboletos/entidad/OrgaoCancelacion.java @@ -16,11 +16,19 @@ import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import javax.persistence.Transient; +import org.hibernate.Hibernate; + +import br.com.rjconsultores.auditador.annotations.AuditarClasse; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; + +@AuditarClasse(nome = "ORGAO_CANCELACION", tela = "Alteração de Orgao Cancelamento") @Entity @Table(name = "ORGAO_CANCELACION") @SequenceGenerator(name = "ORGAO_CANCELACION_SEQ", sequenceName = "ORGAO_CANCELACION_SEQ", allocationSize = 1) -public class OrgaoCancelacion implements Serializable { +public class OrgaoCancelacion implements Serializable, Auditavel { private static final long serialVersionUID = 1L; @@ -108,6 +116,10 @@ public class OrgaoCancelacion implements Serializable { @Column(name = "INDBLOQUEIOREMARCADO") private Boolean indBloqueioRemarcado; + + @Transient + @NaoAuditar + private OrgaoCancelacion orgaoCancelacionClone; public Integer getOrgaoCancelacionId() { return orgaoCancelacionId; @@ -364,6 +376,22 @@ public class OrgaoCancelacion implements Serializable { public void setIndBloqueioRemarcado(Boolean indBloqueioRemarcado) { this.indBloqueioRemarcado = indBloqueioRemarcado; + } + @Override + public void clonar() throws CloneNotSupportedException { + + orgaoCancelacionClone = new OrgaoCancelacion(); + orgaoCancelacionClone = (OrgaoCancelacion) this.clone(); + Hibernate.initialize(orgaoCancelacionClone.getOrgao()); + + } + @Override + public OrgaoCancelacion getCloneObject() throws CloneNotSupportedException { + return orgaoCancelacionClone; + } + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getOrgaoCancelacionId()); } } diff --git a/src/com/rjconsultores/ventaboletos/entidad/OrgaoConcedente.java b/src/com/rjconsultores/ventaboletos/entidad/OrgaoConcedente.java index fded872ca..ec5ab2b3b 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/OrgaoConcedente.java +++ b/src/com/rjconsultores/ventaboletos/entidad/OrgaoConcedente.java @@ -20,23 +20,34 @@ import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import javax.persistence.Transient; import org.apache.commons.lang.BooleanUtils; import org.hibernate.annotations.Where; +import br.com.rjconsultores.auditador.annotations.AuditarAtributo; +import br.com.rjconsultores.auditador.annotations.AuditarClasse; +import br.com.rjconsultores.auditador.annotations.AuditarID; +import br.com.rjconsultores.auditador.annotations.AuditarLista; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; + +@AuditarClasse(nome = "OrgaoConcedente", tela = "Alteração de Orgao Concedente") @Entity @SequenceGenerator(name = "ORGAO_CONCEDENTE_SEQ", sequenceName = "ORGAO_CONCEDENTE_SEQ", allocationSize = 1) @Table(name = "ORGAO_CONCEDENTE") -public class OrgaoConcedente implements Serializable { +public class OrgaoConcedente implements Serializable, Auditavel { private static final long serialVersionUID = 1L; public final static Integer CODIGO_ARTESP = 21; public final static Integer CODIGO_ANTT = 3; + @AuditarID @Id @Basic(optional = false) @GeneratedValue(strategy = GenerationType.AUTO, generator = "ORGAO_CONCEDENTE_SEQ") @Column(name = "ORGAOCONCEDENTE_ID") private Integer orgaoConcedenteId; + @AuditarAtributo(nome = "DESC ORGAO") @Column(name = "DESCORGAO") private String descOrgao; @Column(name = "INDDEFAULTSEGURO") @@ -50,14 +61,18 @@ public class OrgaoConcedente implements Serializable { private Date fecmodif; @Column(name = "USUARIO_ID") private Integer usuarioId; + @AuditarLista(auditarEntidades = true, nome = "CategoriaOrgao") @OneToMany(mappedBy = "orgao") private List categoriaOrgaoList; @Column(name = "INDNOMDOCOBLIGATORIO") private Boolean indNomDocObligatorio; + @AuditarLista(auditarEntidades = true, nome = "OrgaoCancelacion") @OneToMany(mappedBy = "orgao") private List orgaoCancelacionList; + @AuditarAtributo(nome = "INDICE PEDADIO") @Column(name = "INDICEPEAJE") private BigDecimal indicePeaje; + @AuditarAtributo(nome = "Idade Idoso") @Column(name = "IDADE_IDOSO") private Integer idadeIdoso; @Column(name = "IDADE_MINIMA") @@ -75,8 +90,10 @@ public class OrgaoConcedente implements Serializable { private Boolean indValDocObligatorioEmbarcada; @OneToMany(mappedBy = "orgaoConcedente", cascade = CascadeType.ALL) + @NaoAuditar private List classesIndicePeaje; + @AuditarLista(auditarEntidades = true, nome = "OrgaoEmpParam") @OneToMany(mappedBy = "orgaoConcedente", cascade = CascadeType.ALL) @Where(clause = "activo=1") private List orgaoEmpParams; @@ -92,6 +109,10 @@ public class OrgaoConcedente implements Serializable { @Column(name = "TAXA_CONVENIENCIA_SVI") private BigDecimal taxaConvenienciaSVI; + + @Transient + @NaoAuditar + private OrgaoConcedente orgaoConcedenteClone; public void addParametro(OrgaoCancelacion param) { this.orgaoCancelacionList.add(param); @@ -329,4 +350,43 @@ public class OrgaoConcedente implements Serializable { public void setTaxaConvenienciaSVI(BigDecimal taxaConvenienciaSVI) { this.taxaConvenienciaSVI = taxaConvenienciaSVI; } + + @Override + public void clonar() throws CloneNotSupportedException { + + orgaoConcedenteClone = new OrgaoConcedente(); + orgaoConcedenteClone = (OrgaoConcedente) this.clone(); + + if(this.getCategoriaOrgaoList() != null) { + List lsClones = new ArrayList(); + for (CategoriaOrgao categoriaOrgao : this.getCategoriaOrgaoList()) { + if(BooleanUtils.isTrue(categoriaOrgao.getActivo())) { + categoriaOrgao.clonar(); + lsClones.add(categoriaOrgao.getCloneObject()); + } + } + orgaoConcedenteClone.setCategoriaOrgaoList(lsClones); + } + + if(this.getOrgaoCancelacionList() != null) { + List lsClones = new ArrayList(); + for (OrgaoCancelacion orgaoCancelacion : this.getOrgaoCancelacionList()) { + if(BooleanUtils.isTrue(orgaoCancelacion.getActivo())) { + orgaoCancelacion.clonar(); + lsClones.add(orgaoCancelacion.getCloneObject()); + } + } + orgaoConcedenteClone.setOrgaoCancelacionList(lsClones); + } + } + + @Override + public OrgaoConcedente getCloneObject() throws CloneNotSupportedException { + return orgaoConcedenteClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getOrgaoConcedenteId()); + } } diff --git a/src/com/rjconsultores/ventaboletos/entidad/OrgaoEmpParam.java b/src/com/rjconsultores/ventaboletos/entidad/OrgaoEmpParam.java index 95d7d8706..d96a62eb6 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/OrgaoEmpParam.java +++ b/src/com/rjconsultores/ventaboletos/entidad/OrgaoEmpParam.java @@ -15,11 +15,18 @@ import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import javax.persistence.Transient; +import org.hibernate.Hibernate; + +import br.com.rjconsultores.auditador.annotations.AuditarClasse; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; +@AuditarClasse(nome = "OrgaoEmpParam", tela = "Alteração de Orgao Empresa Parametro") @Entity @SequenceGenerator(name = "ORGAO_EMP_PARAM_SEQ", sequenceName = "ORGAO_EMP_PARAM_SEQ", allocationSize = 1) @Table(name = "ORGAO_EMP_PARAM") -public class OrgaoEmpParam implements Serializable { +public class OrgaoEmpParam implements Serializable, Auditavel { private static final long serialVersionUID = 1L; @@ -59,6 +66,10 @@ public class OrgaoEmpParam implements Serializable { @Column(name = "CODEMPRESAPORORGAO", length=30) private String codEmpresaPorOrgao; + @Transient + @NaoAuditar + private OrgaoEmpParam orgaoEmpParamClone; + public String getCodEmpresaPorOrgao() { return codEmpresaPorOrgao; } @@ -139,6 +150,23 @@ public class OrgaoEmpParam implements Serializable { this.indNaoRestringe2ViaBPe = indNaoRestringe2ViaBPe; } + @Override + public void clonar() throws CloneNotSupportedException { + orgaoEmpParamClone = new OrgaoEmpParam(); + orgaoEmpParamClone = (OrgaoEmpParam) this.clone(); + Hibernate.initialize(orgaoEmpParamClone.getOrgaoConcedente()); + } + + @Override + public OrgaoEmpParam getCloneObject() throws CloneNotSupportedException { + return orgaoEmpParamClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getOrgaoempparamId()); + } + @Override public int hashCode() { final int prime = 31; diff --git a/src/com/rjconsultores/ventaboletos/entidad/Parada.java b/src/com/rjconsultores/ventaboletos/entidad/Parada.java index 6ea3b734e..629ed0b71 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/Parada.java +++ b/src/com/rjconsultores/ventaboletos/entidad/Parada.java @@ -107,9 +107,25 @@ public class Parada implements Serializable, Auditavel { @Fetch(value = FetchMode.SUBSELECT) private List codigosOrgaosConcedentes = new ArrayList(); + @Column(name="INDINTEGRACAOW2I") + private Boolean indIntegracaoW2i; + @Transient @NaoAuditar private Parada paradaClone; + + @Transient + @NaoAuditar + Boolean isParadaConexaoRutaExcluida; + + + public Boolean getIsParadaConexaoRutaExcluida() { + return isParadaConexaoRutaExcluida; + } + + public void setIsParadaConexaoRutaExcluida(Boolean isParadaConexaoRutaExcluida) { + this.isParadaConexaoRutaExcluida = isParadaConexaoRutaExcluida; + } public Parada() { super(); @@ -292,7 +308,7 @@ public class Parada implements Serializable, Auditavel { @Override public String toString() { - return getDescparada(); + return getDescparada(); } public String toStringCve() { @@ -355,8 +371,14 @@ public class Parada implements Serializable, Auditavel { this.indVisibleInternet = indVisibleInternet; } - - + public Boolean getIndIntegracaoW2i() { + return indIntegracaoW2i == null ? false : indIntegracaoW2i; + } + + public void setIndIntegracaoW2i(Boolean indIntegracaoW2i) { + this.indIntegracaoW2i = indIntegracaoW2i; + } + public AgrupamentoParada getAgrupamentoParada() { return agrupamentoParada; } @@ -373,9 +395,6 @@ public class Parada implements Serializable, Auditavel { @Override public Parada getCloneObject() throws CloneNotSupportedException { -// if(paradaClone == null) { -// this.clonar(); -// } return paradaClone; } @@ -384,4 +403,9 @@ public class Parada implements Serializable, Auditavel { return String.format("EsquemaAsientoID [%s]", getParadaId()); } + @Override + public Object clone() throws CloneNotSupportedException { + return super.clone(); + } + } diff --git a/src/com/rjconsultores/ventaboletos/entidad/ParamRecoleccion.java b/src/com/rjconsultores/ventaboletos/entidad/ParamRecoleccion.java index 08a6a6d80..b2abf64a0 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/ParamRecoleccion.java +++ b/src/com/rjconsultores/ventaboletos/entidad/ParamRecoleccion.java @@ -19,15 +19,23 @@ import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import javax.persistence.Transient; + +import org.hibernate.Hibernate; + +import br.com.rjconsultores.auditador.annotations.AuditarClasse; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; /** * * @author Desenvolvimento */ +@AuditarClasse(nome = "ParamRecoleccion", tela = "Alteração de Param Coleccion Pnoto de Venda") @Entity @SequenceGenerator(name = "PARAM_RECOLECCION_SEQ", sequenceName = "PARAM_RECOLECCION_SEQ", allocationSize = 1) @Table(name = "PARAM_RECOLECCION") -public class ParamRecoleccion implements Serializable { +public class ParamRecoleccion implements Serializable, Auditavel { private static final long serialVersionUID = 1L; @Id @@ -49,6 +57,10 @@ public class ParamRecoleccion implements Serializable { @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") @ManyToOne private PuntoVenta puntoVenta; + @Transient + @NaoAuditar + private ParamRecoleccion paramRecoleccionClone; + public ParamRecoleccion() { } @@ -137,4 +149,23 @@ public class ParamRecoleccion implements Serializable { public String toString() { return "com.rjconsultores.ventaboletos.entidad.ParamRecoleccion[paramrecoleccionId=" + paramrecoleccionId + "]"; } + + @Override + public void clonar() throws CloneNotSupportedException { + + paramRecoleccionClone = new ParamRecoleccion(); + paramRecoleccionClone = (ParamRecoleccion) this.clone(); + Hibernate.initialize(paramRecoleccionClone.getPuntoVenta()); + + } + + @Override + public ParamRecoleccion getCloneObject() throws CloneNotSupportedException { + return paramRecoleccionClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getParamrecoleccionId()); + } } diff --git a/src/com/rjconsultores/ventaboletos/entidad/PtoVtaCheckin.java b/src/com/rjconsultores/ventaboletos/entidad/PtoVtaCheckin.java index 3f748c7fc..de31a9e5d 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/PtoVtaCheckin.java +++ b/src/com/rjconsultores/ventaboletos/entidad/PtoVtaCheckin.java @@ -20,15 +20,23 @@ import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import javax.persistence.Transient; + +import org.hibernate.Hibernate; + +import br.com.rjconsultores.auditador.annotations.AuditarClasse; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; /** * * @author RJ */ +@AuditarClasse(nome = "PtoVtaCheckin", tela = "Alteração de Localidades/Permitidas/Checkin Ponto de Venda") @Entity @SequenceGenerator(name = "PTOVTA_CHECKIN_SEQ", sequenceName = "PTOVTA_CHECKIN_SEQ", allocationSize = 1) @Table(name = "PTOVTA_CHECKIN") -public class PtoVtaCheckin implements Serializable { +public class PtoVtaCheckin implements Serializable, Auditavel{ private static final long serialVersionUID = 1L; @Id @Basic(optional = false) @@ -54,6 +62,10 @@ public class PtoVtaCheckin implements Serializable { @Column(name = "USUARIO_ID") private int usuarioId; + + @Transient + @NaoAuditar + private PtoVtaCheckin ptoVtaCheckinClone; public PtoVtaCheckin() { } @@ -110,6 +122,24 @@ public class PtoVtaCheckin implements Serializable { this.usuarioId = usuarioId; } + @Override + public void clonar() throws CloneNotSupportedException { + ptoVtaCheckinClone = new PtoVtaCheckin(); + ptoVtaCheckinClone = (PtoVtaCheckin) this.clone(); + Hibernate.initialize(ptoVtaCheckinClone.getPuntoventaId()); + + } + + @Override + public PtoVtaCheckin getCloneObject() throws CloneNotSupportedException { + return ptoVtaCheckinClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getPtoVtaCheckinId()); + } + @Override public int hashCode() { int hash = 0; diff --git a/src/com/rjconsultores/ventaboletos/entidad/PtoVtaSeguro.java b/src/com/rjconsultores/ventaboletos/entidad/PtoVtaSeguro.java index 5d7ea4073..ce1be4635 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/PtoVtaSeguro.java +++ b/src/com/rjconsultores/ventaboletos/entidad/PtoVtaSeguro.java @@ -19,15 +19,23 @@ import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import javax.persistence.Transient; + +import org.hibernate.Hibernate; + +import br.com.rjconsultores.auditador.annotations.AuditarClasse; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; /** * * @author RJ */ +@AuditarClasse(nome = "PtoVtaSeguro", tela = "Alteração de Seguro no Ponto de Venda") @Entity @SequenceGenerator(name = "PTOVTA_SEGURO_SEQ", sequenceName = "PTOVTA_SEGURO_SEQ", allocationSize = 1) @Table(name = "PTOVTA_SEGURO") -public class PtoVtaSeguro implements Serializable { +public class PtoVtaSeguro implements Serializable, Auditavel{ private static final long serialVersionUID = 1L; @Id @Basic(optional = false) @@ -100,6 +108,10 @@ public class PtoVtaSeguro implements Serializable { @Column(name = "INDTAXAEMBARQUEEMBARCADA") private Boolean indTaxaEmbarqueEmbarcada; + @Transient + @NaoAuditar + private PtoVtaSeguro ptoVtaSeguroClone; + public PtoVtaSeguro() { } @@ -267,4 +279,24 @@ public class PtoVtaSeguro implements Serializable { public void setIndTaxaEmbarqueEmbarcada(Boolean indTaxaEmbarqueEmbarcada) { this.indTaxaEmbarqueEmbarcada = indTaxaEmbarqueEmbarcada; } + + @Override + public void clonar() throws CloneNotSupportedException { + + ptoVtaSeguroClone = new PtoVtaSeguro(); + ptoVtaSeguroClone = (PtoVtaSeguro) this.clone(); + Hibernate.initialize(ptoVtaSeguroClone.getPuntoventaId()); + + } + + @Override + public PtoVtaSeguro getCloneObject() throws CloneNotSupportedException { + return ptoVtaSeguroClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getPtoVtaSeguroId()); + } + } diff --git a/src/com/rjconsultores/ventaboletos/entidad/PtoVtaUsuarioBancario.java b/src/com/rjconsultores/ventaboletos/entidad/PtoVtaUsuarioBancario.java index faea97fa4..9c9411c5e 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/PtoVtaUsuarioBancario.java +++ b/src/com/rjconsultores/ventaboletos/entidad/PtoVtaUsuarioBancario.java @@ -17,14 +17,22 @@ import javax.persistence.ManyToOne; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import javax.persistence.Transient; + +import org.hibernate.Hibernate; + +import br.com.rjconsultores.auditador.annotations.AuditarClasse; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; /** * * @author Desenvolvimento */ +@AuditarClasse(nome = "PtoVtaUsuarioBancario", tela = "Alteração Ponto de Venda/Usuario Bancario") @Entity @Table(name = "PTOVTA_USUARIO_BANCARIO") -public class PtoVtaUsuarioBancario implements Serializable { +public class PtoVtaUsuarioBancario implements Serializable, Auditavel { private static final long serialVersionUID = 1L; @Id @@ -48,6 +56,10 @@ public class PtoVtaUsuarioBancario implements Serializable { @JoinColumn(name = "USUARIOBANCARIO_ID", referencedColumnName = "USUARIOBANCARIO_ID") @ManyToOne private UsuarioBancario usuarioBancario; + + @Transient + @NaoAuditar + private PtoVtaUsuarioBancario ptoVtaUsuarioBancarioClone; public PtoVtaUsuarioBancario() { } @@ -107,6 +119,24 @@ public class PtoVtaUsuarioBancario implements Serializable { public void setUsuarioId(Integer usuarioId) { this.usuarioId = usuarioId; } + + @Override + public void clonar() throws CloneNotSupportedException { + ptoVtaUsuarioBancarioClone = new PtoVtaUsuarioBancario(); + ptoVtaUsuarioBancarioClone = (PtoVtaUsuarioBancario) this.clone(); + Hibernate.initialize(ptoVtaUsuarioBancarioClone.getPuntoVenta()); + + } + + @Override + public PtoVtaUsuarioBancario getCloneObject() throws CloneNotSupportedException { + return ptoVtaUsuarioBancarioClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getPtovtaUsuarioBancarioID()); + } @Override public boolean equals(Object obj) { diff --git a/src/com/rjconsultores/ventaboletos/entidad/PtovtaAntecipacomissao.java b/src/com/rjconsultores/ventaboletos/entidad/PtovtaAntecipacomissao.java index ea2216a1f..0d05fb748 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/PtovtaAntecipacomissao.java +++ b/src/com/rjconsultores/ventaboletos/entidad/PtovtaAntecipacomissao.java @@ -7,6 +7,7 @@ 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; @@ -15,22 +16,28 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; -import javax.persistence.NamedQueries; -import javax.persistence.NamedQuery; import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import javax.persistence.Transient; + +import org.hibernate.Hibernate; + +import br.com.rjconsultores.auditador.annotations.AuditarClasse; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; /** * * @author Rafael */ +@AuditarClasse(nome = "PtovtaAntecipacomissao", tela = "Alteração Ponto de Venda/Antecipação Comissão") @Entity @SequenceGenerator(name = "PTOVTA_ANTECIPACOMISSAO_SEQ", sequenceName = "PTOVTA_ANTECIPACOMISSAO_SEQ", allocationSize = 1) @Table(name = "PTOVTA_ANTECIPACOMISSAO") -public class PtovtaAntecipacomissao implements Serializable { +public class PtovtaAntecipacomissao implements Serializable, Auditavel{ private static final long serialVersionUID = 1L; @Id @Basic(optional = false) @@ -61,6 +68,10 @@ public class PtovtaAntecipacomissao implements Serializable { @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") @ManyToOne private PuntoVenta puntoventaId; + + @Transient + @NaoAuditar + private PtovtaAntecipacomissao ptovtaAntecipacomissaoClone; public PtovtaAntecipacomissao() { } @@ -151,6 +162,24 @@ public class PtovtaAntecipacomissao implements Serializable { hash += (ptovtaAntecipaComissaoId != null ? ptovtaAntecipaComissaoId.hashCode() : 0); return hash; } + + @Override + public void clonar() throws CloneNotSupportedException { + + ptovtaAntecipacomissaoClone = new PtovtaAntecipacomissao(); + ptovtaAntecipacomissaoClone = (PtovtaAntecipacomissao) this.clone(); + Hibernate.initialize(ptovtaAntecipacomissaoClone.getPuntoventaId()); + } + + @Override + public PtovtaAntecipacomissao getCloneObject() throws CloneNotSupportedException { + return ptovtaAntecipacomissaoClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getPtovtaAntecipaComissaoId()); + } @Override public boolean equals(Object object) { diff --git a/src/com/rjconsultores/ventaboletos/entidad/PtovtaAntifraude.java b/src/com/rjconsultores/ventaboletos/entidad/PtovtaAntifraude.java index 00c4bc556..2ff62c1c6 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/PtovtaAntifraude.java +++ b/src/com/rjconsultores/ventaboletos/entidad/PtovtaAntifraude.java @@ -17,16 +17,24 @@ import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import javax.persistence.Transient; + +import org.hibernate.Hibernate; import com.rjconsultores.ventaboletos.enums.TipoAntifraude; +import br.com.rjconsultores.auditador.annotations.AuditarClasse; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; + /** * @author Wilian */ +@AuditarClasse(nome = "PtovtaAntifraude", tela = "Alteração Ponto de Venda/Antifraude") @Entity @SequenceGenerator(name = "PTOVTA_ANTIFRAUDE_SEQ", sequenceName = "PTOVTA_ANTIFRAUDE_SEQ", allocationSize = 1) @Table(name = "PTOVTA_ANTIFRAUDE") -public class PtovtaAntifraude implements Serializable { +public class PtovtaAntifraude implements Serializable , Auditavel { private static final long serialVersionUID = 1L; @@ -60,6 +68,10 @@ public class PtovtaAntifraude implements Serializable { @Column(name = "USUARIO_ID") private int usuarioId; + + @Transient + @NaoAuditar + private PtovtaAntifraude ptovtaAntifraudeClone; public PtovtaAntifraude() { super(); @@ -159,5 +171,24 @@ public class PtovtaAntifraude implements Serializable { return false; return true; } + + @Override + public void clonar() throws CloneNotSupportedException { + ptovtaAntifraudeClone = new PtovtaAntifraude(); + ptovtaAntifraudeClone = (PtovtaAntifraude) this.clone(); + Hibernate.initialize(ptovtaAntifraudeClone.getPuntoventa()); + + } + + @Override + public PtovtaAntifraude getCloneObject() throws CloneNotSupportedException { + return ptovtaAntifraudeClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getPtovtaAntifraudeId()); + } + } diff --git a/src/com/rjconsultores/ventaboletos/entidad/PtovtaCatInd.java b/src/com/rjconsultores/ventaboletos/entidad/PtovtaCatInd.java index 3cd733fe9..a56330fe9 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/PtovtaCatInd.java +++ b/src/com/rjconsultores/ventaboletos/entidad/PtovtaCatInd.java @@ -15,11 +15,19 @@ import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import javax.persistence.Transient; +import org.hibernate.Hibernate; + +import br.com.rjconsultores.auditador.annotations.AuditarClasse; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; + +@AuditarClasse(nome = "PtovtaCatInd", tela = "Alteração de Categoria Ponto de Venda") @Entity @SequenceGenerator(name = "PTOVTA_CAT_IND_SEQ", sequenceName = "PTOVTA_CAT_IND_SEQ", allocationSize = 1) @Table(name = "PTOVTA_CAT_IND") -public class PtovtaCatInd implements Serializable { +public class PtovtaCatInd implements Serializable, Auditavel { private static final long serialVersionUID = 1L; @Id @@ -50,6 +58,10 @@ public class PtovtaCatInd implements Serializable { private Boolean indTotalBus; @Column(name = "INDEMBARCADA") private Boolean indEmbarcada; + + @Transient + @NaoAuditar + private PtovtaCatInd ptovtaCatIndConcedente; public Integer getPtovtaCategoriaId() { return ptovtaCategoriaId; @@ -133,6 +145,24 @@ public class PtovtaCatInd implements Serializable { public void setIndEmbarcada(Boolean indEmbarcada) { this.indEmbarcada = indEmbarcada; } + + @Override + public void clonar() throws CloneNotSupportedException { + ptovtaCatIndConcedente = new PtovtaCatInd(); + ptovtaCatIndConcedente = (PtovtaCatInd) this.clone(); + Hibernate.initialize(ptovtaCatIndConcedente.getPuntoVenta()); + + } + @Override + public PtovtaCatInd getCloneObject() throws CloneNotSupportedException { + return ptovtaCatIndConcedente; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getPtovtaCategoriaId()); + } + @Override public int hashCode() { diff --git a/src/com/rjconsultores/ventaboletos/entidad/PtovtaComissao.java b/src/com/rjconsultores/ventaboletos/entidad/PtovtaComissao.java index be6bddf03..406dcf020 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/PtovtaComissao.java +++ b/src/com/rjconsultores/ventaboletos/entidad/PtovtaComissao.java @@ -23,17 +23,25 @@ import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import javax.persistence.Transient; + +import org.apache.commons.lang.BooleanUtils; import com.rjconsultores.ventaboletos.enums.ModeloComissaoImpressaoPosterior; +import br.com.rjconsultores.auditador.annotations.AuditarClasse; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; + /** * * @author Rafael */ +@AuditarClasse(nome = "PtovtaComissao", tela = "Alteração Ponto Veda/Comissão") @Entity @SequenceGenerator(name = "PTOVTA_COMISSAO_SEQ", sequenceName = "PTOVTA_COMISSAO_SEQ", allocationSize = 1) @Table(name = "PTOVTA_COMISSAO") -public class PtovtaComissao implements Serializable { +public class PtovtaComissao implements Serializable, Auditavel { private static final long serialVersionUID = 1L; @Id @Basic(optional = false) @@ -161,7 +169,17 @@ public class PtovtaComissao implements Serializable { private BigDecimal seguroobrigatorioAlta; @Column(name = "SEGUROOBRIGATORIOBAIXA") - private BigDecimal seguroobrigatorioBaixa; + private BigDecimal seguroobrigatorioBaixa; + + @Column(name = "RECARGACELULARALTA") + private BigDecimal recargaCelularAlta; + + @Column(name = "RECARGACELULARBAIXA") + private BigDecimal recargaCelularBaixa; + + @Transient + @NaoAuditar + private PtovtaComissao ptovtaComissaoClone; public PtovtaComissao() { super(); @@ -599,4 +617,45 @@ public class PtovtaComissao implements Serializable { this.seguroobrigatorioBaixa = seguroobrigatorioBaixa; } + public BigDecimal getRecargaCelularAlta() { + return recargaCelularAlta; + } + + public void setRecargaCelularAlta(BigDecimal recargaCelularAlta) { + this.recargaCelularAlta = recargaCelularAlta; + } + + public BigDecimal getRecargaCelularBaixa() { + return recargaCelularBaixa; + } + + public void setRecargaCelularBaixa(BigDecimal recargaCelularBaixa) { + this.recargaCelularBaixa = recargaCelularBaixa; + } + + @Override + public void clonar() throws CloneNotSupportedException { + ptovtaComissaoClone = new PtovtaComissao(); + ptovtaComissaoClone = (PtovtaComissao) this.clone(); + + if (this.getPuntoventaId() != null) { + if (BooleanUtils.isTrue(getPuntoventaId().getActivo())) { + getPuntoventaId().clonar(); + } + ptovtaComissaoClone.setPuntoventaId(getPuntoventaId()); + } + + } + + @Override + public PtovtaComissao getCloneObject() throws CloneNotSupportedException { + return ptovtaComissaoClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getPtovtaComissaoId()); + } + + } diff --git a/src/com/rjconsultores/ventaboletos/entidad/PtovtaEmpresa.java b/src/com/rjconsultores/ventaboletos/entidad/PtovtaEmpresa.java index a2b9e67a9..0aedefef5 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/PtovtaEmpresa.java +++ b/src/com/rjconsultores/ventaboletos/entidad/PtovtaEmpresa.java @@ -26,14 +26,21 @@ import javax.persistence.Temporal; import javax.persistence.TemporalType; import javax.persistence.Transient; +import org.hibernate.Hibernate; + +import br.com.rjconsultores.auditador.annotations.AuditarClasse; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; + /** * * @author Desenvolvimento */ +@AuditarClasse(nome = "PtovtaEmpresa", tela = "Alteração Ponto de Venda/de Empresas/Venda") @Entity @SequenceGenerator(name = "PTOVTA_EMPRESA_SEQ", sequenceName = "PTOVTA_EMPRESA_SEQ", allocationSize = 1) @Table(name = "PTOVTA_EMPRESA") -public class PtovtaEmpresa implements Serializable { +public class PtovtaEmpresa implements Serializable, Auditavel{ private static final long serialVersionUID = 1L; @@ -73,6 +80,7 @@ public class PtovtaEmpresa implements Serializable { @Column(name = "NUMSITEF") private String numeroSitef; + @NaoAuditar @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY) @JoinColumn(name = "PTOVTAEMPRESA_ID", referencedColumnName = "PTOVTAEMPRESA_ID") private List lsPtovtaEmpresaContaBancaria; @@ -84,9 +92,14 @@ public class PtovtaEmpresa implements Serializable { @Column(name = "INDIMPCOMPCARTAO") private Boolean indImpCompCartao; + @NaoAuditar @Transient private List contasBancaria; + @Transient + @NaoAuditar + private PtovtaEmpresa ptovtaEmpresaClone; + public PtovtaEmpresa() { } @@ -238,6 +251,24 @@ public class PtovtaEmpresa implements Serializable { return null; } + @Override + public void clonar() throws CloneNotSupportedException { + ptovtaEmpresaClone = new PtovtaEmpresa(); + ptovtaEmpresaClone = (PtovtaEmpresa) this.clone(); + Hibernate.initialize(ptovtaEmpresaClone.getPuntoVenta()); + + } + + @Override + public PtovtaEmpresa getCloneObject() throws CloneNotSupportedException { + return ptovtaEmpresaClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getPtovtaempresaId()); + } + @Override public int hashCode() { final int prime = 31; diff --git a/src/com/rjconsultores/ventaboletos/entidad/PtovtaEmpresaBloqueada.java b/src/com/rjconsultores/ventaboletos/entidad/PtovtaEmpresaBloqueada.java index da560d3a4..888096543 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/PtovtaEmpresaBloqueada.java +++ b/src/com/rjconsultores/ventaboletos/entidad/PtovtaEmpresaBloqueada.java @@ -15,11 +15,19 @@ import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import javax.persistence.Transient; +import org.hibernate.Hibernate; + +import br.com.rjconsultores.auditador.annotations.AuditarClasse; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; + +@AuditarClasse(nome = "PtovtaEmpresaBloqueada", tela = "Alteração Ponto de Venda/Empresa Bloqueada ") @Entity @SequenceGenerator(name = "PTOVTA_EMP_BLOQUEADA_SEQ", sequenceName = "PTOVTA_EMP_BLOQUEADA_SEQ", allocationSize = 1) @Table(name = "PTOVTA_EMP_BLOQUEADA") -public class PtovtaEmpresaBloqueada implements Serializable { +public class PtovtaEmpresaBloqueada implements Serializable, Auditavel { private static final long serialVersionUID = 1L; @Id @@ -45,6 +53,10 @@ public class PtovtaEmpresaBloqueada implements Serializable { @Column(name = "USUARIO_ID") private Integer usuarioId; + + @Transient + @NaoAuditar + private PtovtaEmpresaBloqueada ptovtaEmpresaBloqueadaClone; public Integer getPtovtaempbloqueadaId() { return ptovtaempbloqueadaId; @@ -105,4 +117,22 @@ public class PtovtaEmpresaBloqueada implements Serializable { } return true; } + + @Override + public void clonar() throws CloneNotSupportedException { + ptovtaEmpresaBloqueadaClone = new PtovtaEmpresaBloqueada(); + ptovtaEmpresaBloqueadaClone = (PtovtaEmpresaBloqueada) this.clone(); + Hibernate.initialize(ptovtaEmpresaBloqueadaClone.getPuntoventaId()); + + } + + @Override + public PtovtaEmpresaBloqueada getCloneObject() throws CloneNotSupportedException { + return ptovtaEmpresaBloqueadaClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getPtovtaempbloqueadaId()); + } } diff --git a/src/com/rjconsultores/ventaboletos/entidad/PtovtaEstoque.java b/src/com/rjconsultores/ventaboletos/entidad/PtovtaEstoque.java index b3478d3b1..51eba52f3 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/PtovtaEstoque.java +++ b/src/com/rjconsultores/ventaboletos/entidad/PtovtaEstoque.java @@ -5,10 +5,7 @@ package com.rjconsultores.ventaboletos.entidad; import java.io.Serializable; -import java.math.BigDecimal; -import java.util.ArrayList; import java.util.Date; -import java.util.List; import javax.persistence.Basic; import javax.persistence.Column; @@ -18,22 +15,28 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; -import javax.persistence.NamedQueries; -import javax.persistence.NamedQuery; import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import javax.persistence.Transient; + +import org.hibernate.Hibernate; + +import br.com.rjconsultores.auditador.annotations.AuditarClasse; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; /** * * @author Rafael */ +@AuditarClasse(nome = "PtoVtaUsuarioBancario", tela = "Alteração Estoque Ponto de Venda") @Entity @SequenceGenerator(name = "PTOVTA_ESTOQUE_SEQ ", sequenceName = "PTOVTA_ESTOQUE_SEQ ", allocationSize = 1) @Table(name = "PTOVTA_ESTOQUE") -public class PtovtaEstoque implements Serializable { +public class PtovtaEstoque implements Serializable, Auditavel{ private static final long serialVersionUID = 1L; @Id @Basic(optional = false) @@ -66,6 +69,10 @@ public class PtovtaEstoque implements Serializable { @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") @ManyToOne private PuntoVenta puntoventaId; + + @Transient + @NaoAuditar + private PtovtaEstoque ptovtaEstoqueClone; public PtovtaEstoque() { } @@ -215,4 +222,22 @@ public class PtovtaEstoque implements Serializable { return "com.rjconsultores.ventaboletos.entidad.PtovtaEstoque[ ptovtaEstoqueId=" + ptovtaEstoqueId + " ]"; } + @Override + public void clonar() throws CloneNotSupportedException { + ptovtaEstoqueClone = new PtovtaEstoque(); + ptovtaEstoqueClone = (PtovtaEstoque) this.clone(); + Hibernate.initialize(ptovtaEstoqueClone.getPuntoventaId()); + + } + + @Override + public PtovtaEstoque getCloneObject() throws CloneNotSupportedException { + return ptovtaEstoqueClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getPtovtaEstoqueId()); + } + } diff --git a/src/com/rjconsultores/ventaboletos/entidad/PtovtaHorario.java b/src/com/rjconsultores/ventaboletos/entidad/PtovtaHorario.java index 0fa630a17..e6e2647c3 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/PtovtaHorario.java +++ b/src/com/rjconsultores/ventaboletos/entidad/PtovtaHorario.java @@ -15,22 +15,28 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; -import javax.persistence.NamedQueries; -import javax.persistence.NamedQuery; import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import javax.persistence.Transient; + +import org.hibernate.Hibernate; + +import br.com.rjconsultores.auditador.annotations.AuditarClasse; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; /** * * @author Rafael */ +@AuditarClasse(nome = "PtovtaHorario", tela = "Alteração Ponto Venda/Horario") @Entity @SequenceGenerator(name = "PTOVTA_HORARIO_SEQ", sequenceName = "PTOVTA_HORARIO_SEQ", allocationSize = 1) @Table(name = "PTOVTA_HORARIO") -public class PtovtaHorario implements Serializable { +public class PtovtaHorario implements Serializable, Auditavel { private static final long serialVersionUID = 1L; @Id @Basic(optional = false) @@ -56,10 +62,16 @@ public class PtovtaHorario implements Serializable { @Column(name = "USUARIO_ID") private int usuarioId; + + @NaoAuditar @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") @ManyToOne private PuntoVenta puntoventaId; + @Transient + @NaoAuditar + private PtovtaHorario ptovtaHorarioClone; + @Column(name = "INDLUNES") private Boolean indlunes; @Column(name = "INDMARTES") @@ -204,6 +216,24 @@ public class PtovtaHorario implements Serializable { public void setInddomingo(Boolean inddomingo) { this.inddomingo = inddomingo; } + + @Override + public void clonar() throws CloneNotSupportedException { + ptovtaHorarioClone = new PtovtaHorario(); + ptovtaHorarioClone = (PtovtaHorario) this.clone(); + Hibernate.initialize(ptovtaHorarioClone.getPuntoventaId()); + + } + + @Override + public PtovtaHorario getCloneObject() throws CloneNotSupportedException { + return ptovtaHorarioClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getPtovtaHorarioId()); + } @Override public int hashCode() { diff --git a/src/com/rjconsultores/ventaboletos/entidad/PtovtaTitular.java b/src/com/rjconsultores/ventaboletos/entidad/PtovtaTitular.java index 18f06f68c..766d7c480 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/PtovtaTitular.java +++ b/src/com/rjconsultores/ventaboletos/entidad/PtovtaTitular.java @@ -5,6 +5,7 @@ package com.rjconsultores.ventaboletos.entidad; import java.io.Serializable; +import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -15,25 +16,31 @@ 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.ManyToOne; -import javax.persistence.NamedQueries; -import javax.persistence.NamedQuery; import javax.persistence.OneToMany; import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import javax.persistence.Transient; + +import org.apache.commons.lang.BooleanUtils; + +import br.com.rjconsultores.auditador.annotations.AuditarAtributo; +import br.com.rjconsultores.auditador.annotations.AuditarClasse; +import br.com.rjconsultores.auditador.annotations.AuditarLista; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; /** * * @author Rafael */ +@AuditarClasse(nome = "PtovtaTitular", tela = "Alteração Ponto Veda/Titular/Foto") @Entity @Table(name = "PTOVTA_TITULAR") @SequenceGenerator(name = "PTOVTA_TITULAR_SEQ ", sequenceName = "PTOVTA_TITULAR_SEQ ", allocationSize = 1) -public class PtovtaTitular implements Serializable { +public class PtovtaTitular implements Serializable, Auditavel { private static final long serialVersionUID = 1L; @Id @Basic(optional = false) @@ -41,6 +48,7 @@ public class PtovtaTitular implements Serializable { @Column(name = "PTOVTATITULAR_ID") private Integer ptovtaTitularId; + @AuditarAtributo(nome = "NOME TITULAR/FOTO") @Column(name = "NOME") private String nome; @@ -65,9 +73,15 @@ public class PtovtaTitular implements Serializable { private Date fecmodif; @Column(name = "USUARIO_ID") - private int usuarioId; + private int usuarioId; + + @OneToMany(cascade = CascadeType.ALL, mappedBy = "titularId") private List puntoVentaList; + + @Transient + @NaoAuditar + private PtovtaTitular ptovtaTitularClone; public PtovtaTitular() { } @@ -195,4 +209,33 @@ public class PtovtaTitular implements Serializable { return "com.rjconsultores.ventaboletos.entidad.PtovtaTitular[ ptovtaTitularId=" + ptovtaTitularId + " ]"; } + @Override + public void clonar() throws CloneNotSupportedException { + ptovtaTitularClone = new PtovtaTitular(); + ptovtaTitularClone = (PtovtaTitular) this.clone(); + + if(this.getPuntoVentaList() != null) { + List lsClones = new ArrayList(); + for (PuntoVenta puntoVenta : this.getPuntoVentaList()) { + if(BooleanUtils.isTrue(puntoVenta.getActivo())) { + puntoVenta.clonar(); + lsClones.add(puntoVenta.getCloneObject()); + } + } + ptovtaTitularClone.setPuntoVentaList(lsClones); + } + + } + + @Override + public PtovtaTitular getCloneObject() throws CloneNotSupportedException { + return ptovtaTitularClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getPtovtaTitularId()); + } + + } diff --git a/src/com/rjconsultores/ventaboletos/entidad/PuntoVenta.java b/src/com/rjconsultores/ventaboletos/entidad/PuntoVenta.java index 09dab4d7e..824c33c0f 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/PuntoVenta.java +++ b/src/com/rjconsultores/ventaboletos/entidad/PuntoVenta.java @@ -29,8 +29,10 @@ import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import javax.persistence.Transient; import org.apache.commons.lang.BooleanUtils; +import org.hibernate.Hibernate; import org.hibernate.annotations.LazyCollection; import org.hibernate.annotations.LazyCollectionOption; import org.hibernate.annotations.Where; @@ -38,14 +40,22 @@ import org.hibernate.annotations.Where; import com.rjconsultores.ventaboletos.enums.TipoSocio; import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +import br.com.rjconsultores.auditador.annotations.AuditarAtributo; +import br.com.rjconsultores.auditador.annotations.AuditarClasse; +import br.com.rjconsultores.auditador.annotations.AuditarEntidade; +import br.com.rjconsultores.auditador.annotations.AuditarLista; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; + /** * * @author Rafius */ @Entity @SequenceGenerator(name = "PUNTO_VENTA_SEQ", sequenceName = "PUNTO_VENTA_SEQ", allocationSize = 1) +@AuditarClasse(nome = "PuntoVenta", tela = "Alteração de Ponto de Venda") @Table(name = "PUNTO_VENTA") -public class PuntoVenta implements Serializable { +public class PuntoVenta implements Serializable, Auditavel { private static final long serialVersionUID = 1L; @Id @@ -53,6 +63,7 @@ public class PuntoVenta implements Serializable { @GeneratedValue(strategy = GenerationType.AUTO, generator = "PUNTO_VENTA_SEQ") @Column(name = "PUNTOVENTA_ID") private Integer puntoventaId; + @AuditarAtributo(nome = "NOME PONTO DE VENDA") @Column(name = "NOMBPUNTOVENTA") private String nombpuntoventa; @Column(name = "DIRECCIONCALLE") @@ -91,6 +102,7 @@ public class PuntoVenta implements Serializable { @JoinColumn(name = "TIPOPTOVTA_ID", referencedColumnName = "TIPOPTOVTA_ID") @ManyToOne private TipoPuntoVenta tipoPuntoVenta; + @AuditarLista(auditarEntidades = true, nome = "ReservacionPuntoVenta") @OneToMany(mappedBy = "puntoVenta") private List reservacionPuntoventaList; @OneToOne @@ -105,40 +117,63 @@ public class PuntoVenta implements Serializable { @OneToOne @JoinColumn(name = "USUARIOBANCARIO_ID") private UsuarioBancario usuarioBancario; + + @AuditarLista(auditarEntidades = true, nome = "FormaPagoDet") @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY) @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") private List lsFormaPagoDet; + + @AuditarLista(auditarEntidades = true, nome = "ParamRecoleccion") @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY) @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") private List lsParamRecoleccion; + + @AuditarLista(auditarEntidades = true, nome = "PtovtaEmpresa") @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY) @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") private List lsPtovtaEmpresa; + + @AuditarLista(auditarEntidades = true, nome = "PtoVtaUsuarioBancario") @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY) @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") private List lsPtovtaUsuarioBancario; + @Column(name = "NUMFAX") private String numfax; @Column(name = "COMPLE") private String compl; + + @AuditarLista(auditarEntidades = true, nome = "PtovtaEstoque") @OneToMany(cascade = CascadeType.ALL, mappedBy = "puntoventaId") private List ptovtaEstoqueList; + + + @AuditarLista(auditarEntidades = true, nome = "PtovtaHorario") @OneToMany(cascade = CascadeType.ALL, mappedBy = "puntoventaId") private List ptovtaHorarioList; + + @AuditarLista(auditarEntidades = true, nome = "PtovtaAntecipacomissao") @OneToMany(cascade = CascadeType.ALL, mappedBy = "puntoventaId") private List ptovtaAntecipacomissaoList; + + @AuditarEntidade @JoinColumn(name = "PTOVTACOMISSAO_ID") @OneToOne(cascade = CascadeType.ALL) private PtovtaComissao comissaoId; + @JoinColumn(name = "PTOVTADIVERSOS_ID") @OneToOne(cascade = CascadeType.ALL) private PtovtaDiversos diversosId; @JoinColumn(name = "PTOVTAAGENCIA_ID") @OneToOne(cascade = CascadeType.ALL) private PtovtaAgencia agenciaId; + + @AuditarEntidade @JoinColumn(name = "PTOVTATITULAR_ID") @OneToOne(cascade = CascadeType.ALL) private PtovtaTitular titularId; + + @AuditarAtributo(nome = "NUMERO PONTO DE VENDA") @Column(name = "NUMPUNTOVENTA") private String numPuntoVenta; @Column(name = "INDPERMISOTASAEMBARQUE") @@ -179,18 +214,22 @@ public class PuntoVenta implements Serializable { @Column(name = "MOTIVONAOINTEGRADOAG") private String motivoNaoIntegradoAG; + @AuditarLista(auditarEntidades = true, nome = "PtovtaEmpresaBloqueada") @OneToMany(cascade = CascadeType.ALL, mappedBy = "puntoventaId") @LazyCollection(LazyCollectionOption.FALSE) private List ptovtaEmpresaBloqueadaList; + @AuditarLista(auditarEntidades = true, nome = "PtoVtaCheckin") @OneToMany(cascade = CascadeType.ALL, mappedBy = "puntoventaId") @LazyCollection(LazyCollectionOption.FALSE) private List ptovtaCheckinList; + @AuditarLista(auditarEntidades = true, nome = "PtoVtaSeguro") @OneToMany(cascade = CascadeType.ALL, mappedBy = "puntoventaId") @LazyCollection(LazyCollectionOption.FALSE) private List ptovtaSeguroList; + @AuditarLista(auditarEntidades = true, nome = "PtovtaCatInd") @OneToMany(cascade = CascadeType.ALL, mappedBy = "puntoVenta") @LazyCollection(LazyCollectionOption.FALSE) private List ptovtaCatIndList; @@ -216,10 +255,12 @@ public class PuntoVenta implements Serializable { @Temporal(TemporalType.TIMESTAMP) private Date dateAbertura; + @AuditarLista(auditarEntidades = true, nome = "HistoricoPuntoVenta") @OneToMany(cascade = CascadeType.ALL, mappedBy = "puntoVenta") @LazyCollection(LazyCollectionOption.FALSE) private List historicoPuntoVentaList; + @AuditarLista(auditarEntidades = true, nome = "CategoriaBloqueioImpPosterior") @OneToMany(cascade = CascadeType.ALL, mappedBy = "puntoventa") @LazyCollection(LazyCollectionOption.FALSE) private List categoriaBloqImpPosteriorList; @@ -239,6 +280,7 @@ public class PuntoVenta implements Serializable { @Column(name = "INDREPASSAUTR") private Boolean indRepassaUTR; + @AuditarLista(auditarEntidades = true, nome = "PtovtaAntifraude") @OneToMany(mappedBy = "puntoventa", cascade = CascadeType.ALL) @LazyCollection(LazyCollectionOption.FALSE) @Where(clause = "activo = 1") @@ -247,6 +289,7 @@ public class PuntoVenta implements Serializable { @Column(name = "INDBLOQUEIATIPOPASSAGEM") private Boolean indBloqueiaTipoPassagem; + @AuditarLista(auditarEntidades = true, nome = "CobrancaAdcPuntoVenta") @OneToMany(mappedBy = "puntoVenta", cascade = CascadeType.ALL) @LazyCollection(LazyCollectionOption.FALSE) @Where(clause = "activo = 1") @@ -270,7 +313,14 @@ public class PuntoVenta implements Serializable { @Column(name = "INDQRCODETAXAEMBARQUERODTTL") private Boolean indQrcodeTaxaEmbarqueRodTTL; + + @Transient + @NaoAuditar + private PuntoVenta puntoVentaClone; + @Column(name = "INDBLOQCANCBILHETEIMPRESSO ") + private Boolean indBloqueiaCancelamentoBilheteImpresso; + public List getCobrancaAdicionalList() { return cobrancaAdicionalList; } @@ -1199,5 +1249,32 @@ public class PuntoVenta implements Serializable { public void setIndQrcodeTaxaEmbarqueRodTTL(Boolean indQrcodeTaxaEmbarqueRodTTL) { this.indQrcodeTaxaEmbarqueRodTTL = indQrcodeTaxaEmbarqueRodTTL; } + @Override + public void clonar() throws CloneNotSupportedException { + puntoVentaClone = new PuntoVenta(); + puntoVentaClone = (PuntoVenta) this.clone(); + + if(this.getReservacionPuntoventaList() != null) { + List lsClones = new ArrayList(); + for (ReservacionPuntoVenta reservacionPuntoVenta : this.getReservacionPuntoventaList()) { + if(BooleanUtils.isTrue(reservacionPuntoVenta.getActivo())) { + reservacionPuntoVenta.clonar(); + lsClones.add(reservacionPuntoVenta.getCloneObject()); + } + } + puntoVentaClone.setReservacionPuntoventaList(lsClones); + } + + } + + @Override + public PuntoVenta getCloneObject() throws CloneNotSupportedException { + return puntoVentaClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getPuntoventaId()); + } } \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/entidad/ReservacionPuntoVenta.java b/src/com/rjconsultores/ventaboletos/entidad/ReservacionPuntoVenta.java index 2afd57bcb..ef36ca540 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/ReservacionPuntoVenta.java +++ b/src/com/rjconsultores/ventaboletos/entidad/ReservacionPuntoVenta.java @@ -17,126 +17,160 @@ import javax.persistence.ManyToOne; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import javax.persistence.Transient; + +import org.hibernate.Hibernate; + +import br.com.rjconsultores.auditador.annotations.AuditarClasse; +import br.com.rjconsultores.auditador.annotations.NaoAuditar; +import br.com.rjconsultores.auditador.interfaces.Auditavel; + import javax.persistence.SequenceGenerator; /** * * @author Rafius */ + +@AuditarClasse(nome = "ReservacionPuntoVenta", tela = "Alteração de Reserva Punto Venta") @Entity -@SequenceGenerator(name = "RESERVACION_PUNTOVENTA_SEQ", sequenceName = "RESERVACION_PUNTOVENTA_SEQ", allocationSize=1) +@SequenceGenerator(name = "RESERVACION_PUNTOVENTA_SEQ", sequenceName = "RESERVACION_PUNTOVENTA_SEQ", allocationSize = 1) @Table(name = "RESERVACION_PUNTOVENTA") -public class ReservacionPuntoVenta implements Serializable { +public class ReservacionPuntoVenta implements Serializable, Auditavel { - private static final long serialVersionUID = 1L; - @Id - @Basic(optional = false) - @GeneratedValue(strategy = GenerationType.AUTO, generator = "RESERVACION_PUNTOVENTA_SEQ") - @Column(name = "RESERVACIONPTOVTA_ID") - private Integer reservacionptovtaId; - @Column(name = "ACTIVO") - private Boolean activo; - @Column(name = "FECMODIF") - @Temporal(TemporalType.TIMESTAMP) - private Date fecmodif; - @Column(name = "USUARIO_ID") - private Integer usuarioId; - @JoinColumn(name = "RESERVACIONCTRL_ID", referencedColumnName = "RESERVACIONCTRL_ID") - @ManyToOne - private ReservacionCtrl reservacionCtrl; - @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") - @ManyToOne - private PuntoVenta puntoVenta; + private static final long serialVersionUID = 1L; + @Id + @Basic(optional = false) + @GeneratedValue(strategy = GenerationType.AUTO, generator = "RESERVACION_PUNTOVENTA_SEQ") + @Column(name = "RESERVACIONPTOVTA_ID") + private Integer reservacionptovtaId; + @Column(name = "ACTIVO") + private Boolean activo; + @Column(name = "FECMODIF") + @Temporal(TemporalType.TIMESTAMP) + private Date fecmodif; + @Column(name = "USUARIO_ID") + private Integer usuarioId; - public ReservacionPuntoVenta() { - } + @NaoAuditar + @JoinColumn(name = "RESERVACIONCTRL_ID", referencedColumnName = "RESERVACIONCTRL_ID") + @ManyToOne + private ReservacionCtrl reservacionCtrl; + @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID") - public ReservacionPuntoVenta(Integer reservacionptovtaId) { - this.reservacionptovtaId = reservacionptovtaId; - } + @NaoAuditar + @ManyToOne + private PuntoVenta puntoVenta; - public Integer getReservacionptovtaId() { - return reservacionptovtaId; - } + @Transient + @NaoAuditar + private ReservacionPuntoVenta reservacionPuntoVentaClone; - public void setReservacionptovtaId(Integer reservacionptovtaId) { - this.reservacionptovtaId = reservacionptovtaId; - } + public ReservacionPuntoVenta() { + } - public Boolean getActivo() { - return activo; - } + public ReservacionPuntoVenta(Integer reservacionptovtaId) { + this.reservacionptovtaId = reservacionptovtaId; + } - public void setActivo(Boolean activo) { - this.activo = activo; - } + public Integer getReservacionptovtaId() { + return reservacionptovtaId; + } - public Date getFecmodif() { - return fecmodif; - } + public void setReservacionptovtaId(Integer reservacionptovtaId) { + this.reservacionptovtaId = reservacionptovtaId; + } - public void setFecmodif(Date fecmodif) { - this.fecmodif = fecmodif; - } + public Boolean getActivo() { + return activo; + } - public Integer getUsuarioId() { - return usuarioId; - } + public void setActivo(Boolean activo) { + this.activo = activo; + } - public void setUsuarioId(Integer usuarioId) { - this.usuarioId = usuarioId; - } + public Date getFecmodif() { + return fecmodif; + } - public ReservacionCtrl getReservacionCtrl() { - return reservacionCtrl; - } + public void setFecmodif(Date fecmodif) { + this.fecmodif = fecmodif; + } - public void setReservacionCtrl(ReservacionCtrl reservacionCtrl) { - this.reservacionCtrl = reservacionCtrl; - } + public Integer getUsuarioId() { + return usuarioId; + } - public PuntoVenta getPuntoVenta() { - return puntoVenta; - } + public void setUsuarioId(Integer usuarioId) { + this.usuarioId = usuarioId; + } - public void setPuntoVenta(PuntoVenta puntoVenta) { - this.puntoVenta = puntoVenta; - } + public ReservacionCtrl getReservacionCtrl() { + return reservacionCtrl; + } - @Override - public boolean equals(Object obj) { - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - final ReservacionPuntoVenta other = (ReservacionPuntoVenta) obj; - if (this.activo != other.activo && (this.activo == null || !this.activo.equals(other.activo))) { - return false; - } - if (this.reservacionCtrl != other.reservacionCtrl && (this.reservacionCtrl == null || !this.reservacionCtrl.equals(other.reservacionCtrl))) { - return false; - } - if (this.puntoVenta != other.puntoVenta && (this.puntoVenta == null || !this.puntoVenta.equals(other.puntoVenta))) { - return false; - } - return true; - } + public void setReservacionCtrl(ReservacionCtrl reservacionCtrl) { + this.reservacionCtrl = reservacionCtrl; + } - @Override - public int hashCode() { - int hash = 7; - hash = 79 * hash + (this.activo != null ? this.activo.hashCode() : 0); - hash = 79 * hash + (this.reservacionCtrl != null ? this.reservacionCtrl.hashCode() : 0); - hash = 79 * hash + (this.puntoVenta != null ? this.puntoVenta.hashCode() : 0); - return hash; - } + public PuntoVenta getPuntoVenta() { + return puntoVenta; + } - + public void setPuntoVenta(PuntoVenta puntoVenta) { + this.puntoVenta = puntoVenta; + } - @Override - public String toString() { - return "com.rjconsultores.ventaboletos.entidad.ReservacionPuntoventa[reservacionptovtaId=" + reservacionptovtaId + "]"; - } + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final ReservacionPuntoVenta other = (ReservacionPuntoVenta) obj; + if (this.activo != other.activo && (this.activo == null || !this.activo.equals(other.activo))) { + return false; + } + if (this.reservacionCtrl != other.reservacionCtrl && (this.reservacionCtrl == null || !this.reservacionCtrl.equals(other.reservacionCtrl))) { + return false; + } + if (this.puntoVenta != other.puntoVenta && (this.puntoVenta == null || !this.puntoVenta.equals(other.puntoVenta))) { + return false; + } + return true; + } + + @Override + public int hashCode() { + int hash = 7; + hash = 79 * hash + (this.activo != null ? this.activo.hashCode() : 0); + hash = 79 * hash + (this.reservacionCtrl != null ? this.reservacionCtrl.hashCode() : 0); + hash = 79 * hash + (this.puntoVenta != null ? this.puntoVenta.hashCode() : 0); + return hash; + } + + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.ReservacionPuntoventa[reservacionptovtaId=" + reservacionptovtaId + "]"; + } + + @Override + public void clonar() throws CloneNotSupportedException { + reservacionPuntoVentaClone = new ReservacionPuntoVenta(); + reservacionPuntoVentaClone = (ReservacionPuntoVenta) this.clone(); + Hibernate.initialize(reservacionPuntoVentaClone.getPuntoVenta()); + + } + + @Override + public ReservacionPuntoVenta getCloneObject() throws CloneNotSupportedException { + return reservacionPuntoVentaClone; + } + + @Override + public String getTextoInclusaoExclusao() { + return String.format("ID [%s]", getReservacionptovtaId()); + } } diff --git a/src/com/rjconsultores/ventaboletos/entidad/Ruta.java b/src/com/rjconsultores/ventaboletos/entidad/Ruta.java index 4c822a109..42aa36f41 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/Ruta.java +++ b/src/com/rjconsultores/ventaboletos/entidad/Ruta.java @@ -137,15 +137,6 @@ public class Ruta implements Serializable, Comparable, Auditavel { @Column(name = "INDVENDAEMBARCADA") private Boolean indVendaEmbarcada; - @Column(name = "INDPRECIOPORDEMANDA") - private Boolean indPrecioPorDemanda; - - @Column(name = "FECINIPRECIODEMANDA") - private Date fecInicioPrecioDemanda; - - @Column(name = "FECFIMPRECIODEMANDA") - private Date fecFimPrecioDemanda; - @OneToMany(mappedBy = "ruta", cascade = CascadeType.ALL) private List lsRutaEmbarqueDesembarque; @@ -156,15 +147,27 @@ public class Ruta implements Serializable, Comparable, Auditavel { @Transient private Boolean isClone; + @Transient + @NaoAuditar + private Boolean isCadastro; + @Column(name = "indnumfidelidadobligatorio") private Boolean indNumFidelidadObligatorio; + @Transient + @NaoAuditar + private List rutaCombinacionTemporariaList; + @Transient @NaoAuditar private Ruta rutaClone; @Column(name = "STATUS_AUTORIZADORA") private Integer statusAutorizadora; + + @Transient + @NaoAuditar + private ClaseServicio claseServicioRutaOrigem; public Ruta() { super(); @@ -199,9 +202,7 @@ public class Ruta implements Serializable, Comparable, Auditavel { ruta.indTribTaxaEmbarque = other.indTribTaxaEmbarque; ruta.indVentaRioCard = other.indVentaRioCard; ruta.indRutaInternacional = other.indRutaInternacional; - ruta.indPrecioPorDemanda = other.indPrecioPorDemanda; - ruta.fecInicioPrecioDemanda = other.fecInicioPrecioDemanda; - ruta.fecFimPrecioDemanda = other.fecFimPrecioDemanda; + /******* ruta.lsRutaEmpresa *************/ if (ruta.lsRutaEmpresa == null) { @@ -253,6 +254,7 @@ public class Ruta implements Serializable, Comparable, Auditavel { ruta.usuarioId = other.usuarioId; ruta.ventaOffLine = other.ventaOffLine; + ruta.claseServicioRutaOrigem=other.claseServicioRutaOrigem; return ruta; } @@ -565,7 +567,7 @@ public class Ruta implements Serializable, Comparable, Auditavel { } public Boolean getIsClone() { - return isClone; + return isClone == null ? false: isClone; } public void setIsClone(Boolean isClone) { @@ -627,30 +629,6 @@ public class Ruta implements Serializable, Comparable, Auditavel { public String getTextoInclusaoExclusao() { return String.format("ID [%s]", getRutaId()); } - - public Boolean getIndPrecioPorDemanda() { - return indPrecioPorDemanda; - } - - public void setIndPrecioPorDemanda(Boolean indPrecioPorDemanda) { - this.indPrecioPorDemanda = indPrecioPorDemanda; - } - - public Date getFecInicioPrecioDemanda() { - return fecInicioPrecioDemanda; - } - - public void setFecInicioPrecioDemanda(Date fecInicioPrecioDemanda) { - this.fecInicioPrecioDemanda = fecInicioPrecioDemanda; - } - - public Date getFecFimPrecioDemanda() { - return fecFimPrecioDemanda; - } - - public void setFecFimPrecioDemanda(Date fecFimPrecioDemanda) { - this.fecFimPrecioDemanda = fecFimPrecioDemanda; - } public String getDescSentido() { return this.getIndSentidoIda() == null || Boolean.TRUE.equals(this.getIndSentidoIda()) ? "IDA" : "VOLTA"; @@ -663,4 +641,34 @@ public class Ruta implements Serializable, Comparable, Auditavel { public void setStatusAutorizadora(Integer statusAutorizadora) { this.statusAutorizadora = statusAutorizadora; } + + public List getRutaCombinacionTemporariaList() { + return rutaCombinacionTemporariaList; + } + + public void setRutaCombinacionTemporariaList(List rutaCombinacionTemporariaList) { + this.rutaCombinacionTemporariaList = rutaCombinacionTemporariaList; + } + + public Boolean getIsCadastro() { + return isCadastro==null?false:isCadastro; + } + + public void setIsCadastro(Boolean isCadastro) { + this.isCadastro = isCadastro; + } + + public ClaseServicio getClaseServicioRutaOrigem() { + return claseServicioRutaOrigem; + } + + public void setClaseServicioRutaOrigem(ClaseServicio claseServicioRutaOrigem) { + this.claseServicioRutaOrigem = claseServicioRutaOrigem; + } + + + + + + } \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/entidad/RutaIcmsExcepcion.java b/src/com/rjconsultores/ventaboletos/entidad/RutaIcmsExcepcion.java index 54308f6e2..47412c1e9 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/RutaIcmsExcepcion.java +++ b/src/com/rjconsultores/ventaboletos/entidad/RutaIcmsExcepcion.java @@ -60,6 +60,9 @@ public class RutaIcmsExcepcion implements Serializable { @Column(name = "USUARIO_ID") private Integer usuarioId; + @Column(name = "indCST41") + private Boolean indCST41; + public Integer getRutaIcmsExcepcionId() { return rutaIcmsExcepcionId; } @@ -139,6 +142,14 @@ public class RutaIcmsExcepcion implements Serializable { public void setUsuarioId(Integer usuarioId) { this.usuarioId = usuarioId; } + + public Boolean getIndCST41() { + return indCST41; + } + + public void setIndCST41(Boolean indCST41) { + this.indCST41 = indCST41; + } @Override public int hashCode() { diff --git a/src/com/rjconsultores/ventaboletos/enums/TipoFormapago.java b/src/com/rjconsultores/ventaboletos/enums/TipoFormapago.java index e254c14fe..78921b454 100644 --- a/src/com/rjconsultores/ventaboletos/enums/TipoFormapago.java +++ b/src/com/rjconsultores/ventaboletos/enums/TipoFormapago.java @@ -18,7 +18,9 @@ public enum TipoFormapago { DEPOSITO(11,Labels.getLabel("editarFormaPagoController.lblDeposito.label")), CARTEIRA_DIGITAL(12,Labels.getLabel("editarFormaPagoController.lblCarteiraDigital.label")), SMART_CARD(13,Labels.getLabel("editarFormaPagoController.lblSmartCard.label")), - LOGPAY(14,Labels.getLabel("editarFormaPagoController.lblLogpay.label")); + LOGPAY(14,Labels.getLabel("editarFormaPagoController.lblLogpay.label")), + TPI(15, Labels.getLabel("editarFormaPagoController.lblTPI.label")), + MOBIPIX(16,Labels.getLabel("editarFormaPagoController.lblMobiPix.label")); private Integer valor; private String descricao; diff --git a/src/com/rjconsultores/ventaboletos/service/BoletoService.java b/src/com/rjconsultores/ventaboletos/service/BoletoService.java index 2a4a6a66a..73342618d 100644 --- a/src/com/rjconsultores/ventaboletos/service/BoletoService.java +++ b/src/com/rjconsultores/ventaboletos/service/BoletoService.java @@ -4,6 +4,7 @@ */ package com.rjconsultores.ventaboletos.service; +import java.math.BigDecimal; import java.util.Date; import com.rjconsultores.ventaboletos.entidad.Boleto; @@ -18,6 +19,10 @@ public interface BoletoService { public Boleto suscribir(Boleto boleto); - public void criaBoletoReserva(String unoAsientoSelec, Integer unaCorridaId, Date unaFecCorrida, Integer unoTerminalOrigenId, Integer unoTerminalDestinoId, Integer unoTipoVenta, Integer unaCategoriaSelec, String unoNumeOperacion, Integer unUsuarioId, Integer unPuntoVenta, Integer unClienteId, Integer rutaId, Float tarifa, Long tempoReserva, Integer estacionId, String cpf, String numFidelidade, Integer claseservicioId, Short marcaId, Date fecViaje, Integer empresaCorridaId, String nombPassageiro) throws Exception; + public void criaBoletoReserva(String unoAsientoSelec, Integer unaCorridaId, Date unaFecCorrida, Integer unoTerminalOrigenId, + Integer unoTerminalDestinoId, Integer unoTipoVenta, Integer unaCategoriaSelec, String unoNumeOperacion, Integer unUsuarioId, + Integer unPuntoVenta, Integer unClienteId, Integer rutaId, BigDecimal tarifa, Long tempoReserva, Integer estacionId, String cpf, + String numFidelidade, Integer claseservicioId, Short marcaId, Date fecViaje, Integer empresaCorridaId, String nombPassageiro, + BigDecimal valorSeguro, BigDecimal valorTaxaEmbarque, BigDecimal valorPedagio) throws Exception; } \ No newline at end of file diff --git a/src/com/rjconsultores/ventaboletos/service/CategoriaCtrlService.java b/src/com/rjconsultores/ventaboletos/service/CategoriaCtrlService.java index dab713398..4c14b862d 100644 --- a/src/com/rjconsultores/ventaboletos/service/CategoriaCtrlService.java +++ b/src/com/rjconsultores/ventaboletos/service/CategoriaCtrlService.java @@ -17,7 +17,7 @@ public interface CategoriaCtrlService { public CategoriaCtrl suscribir(CategoriaCtrl entidad); - public CategoriaCtrl checarCategoriaAdulto(CategoriaCtrl entidad); + public CategoriaCtrl checarCategoriaAdulto(CategoriaCtrl entidad, Boolean rdVendeAbertoSim, Boolean chkCancelaEmAberto, Boolean chkDevolveEmAberto, Boolean chkCancelaEmergencialEmAberto, Boolean chkTrocaTiturlidadeEmAberto, Boolean chkTrocaEmAberto); public CategoriaCtrl actualizacion(CategoriaCtrl entidad); diff --git a/src/com/rjconsultores/ventaboletos/service/ConexionRutaTramoCtrlService.java b/src/com/rjconsultores/ventaboletos/service/ConexionRutaTramoCtrlService.java index 644ed4363..2c87366b9 100644 --- a/src/com/rjconsultores/ventaboletos/service/ConexionRutaTramoCtrlService.java +++ b/src/com/rjconsultores/ventaboletos/service/ConexionRutaTramoCtrlService.java @@ -24,11 +24,11 @@ public interface ConexionRutaTramoCtrlService { public boolean validarConexioneRutasExistentes(Integer rutaOrigenId, Integer rutaDestinoId, Integer paradaOrigenId, Integer paradaDestinoId, Integer origemTrechoId, Integer destinoTrechoId, Integer integer); - public List buscarLocalidadesOrigem(Integer conexionRutaConfId); + public List buscarLocalidadesEixoA(Integer conexionRutaConfId); - public List buscarLocalidadesDestino(Integer conexionRutaConfId); + public List buscarLocalidadeEixoB(Integer conexionRutaConfId); - public List buscarLocalidadesDestinoC(Integer conexionRutaConfId); + public List buscarLocalidadesEixoC(Integer conexionRutaConfId); public List buscarTodasLocalidadesOrigem(Integer conexionRutaConfId); diff --git a/src/com/rjconsultores/ventaboletos/service/ConexionService.java b/src/com/rjconsultores/ventaboletos/service/ConexionService.java index 044ab4b5f..4813a1e75 100644 --- a/src/com/rjconsultores/ventaboletos/service/ConexionService.java +++ b/src/com/rjconsultores/ventaboletos/service/ConexionService.java @@ -13,7 +13,7 @@ public interface ConexionService { */ public void gerarConexiones(); - public List buscarConexiones(Integer origenId, Integer destinoId); + public List buscarConexiones(boolean isBuscaAgrupada, Integer origenId, Integer destinoId); public Conexion suscribir(Conexion conexion); diff --git a/src/com/rjconsultores/ventaboletos/service/ConstanteService.java b/src/com/rjconsultores/ventaboletos/service/ConstanteService.java index c3919acb4..203a5e07d 100644 --- a/src/com/rjconsultores/ventaboletos/service/ConstanteService.java +++ b/src/com/rjconsultores/ventaboletos/service/ConstanteService.java @@ -27,4 +27,6 @@ public interface ConstanteService extends GenericService { public String buscarURLAPI(); public Integer buscarValorConstantePorNomeConstante(String nomeConstante); + + public String buscarURLAPIEmb(); } diff --git a/src/com/rjconsultores/ventaboletos/service/ParadaService.java b/src/com/rjconsultores/ventaboletos/service/ParadaService.java index 6f0b64a65..aac9bbd51 100644 --- a/src/com/rjconsultores/ventaboletos/service/ParadaService.java +++ b/src/com/rjconsultores/ventaboletos/service/ParadaService.java @@ -6,6 +6,7 @@ package com.rjconsultores.ventaboletos.service; import java.util.List; +import com.rjconsultores.ventaboletos.entidad.AgrupamentoParada; import com.rjconsultores.ventaboletos.entidad.Ciudad; import com.rjconsultores.ventaboletos.entidad.Nodo; import com.rjconsultores.ventaboletos.entidad.Parada; @@ -43,4 +44,6 @@ public interface ParadaService { public List obterPossiveisDestinos(Parada origem); public List buscaParadaRegionMetropolitana(RegionMetropolitana regionMetropolitana); + + public List buscarPorAgrupamentoParadaId(AgrupamentoParada agrupamentoParada); } diff --git a/src/com/rjconsultores/ventaboletos/service/impl/BoletoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/BoletoServiceImpl.java index 81d491d57..d936c5edc 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/BoletoServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/BoletoServiceImpl.java @@ -14,6 +14,7 @@ import org.springframework.transaction.annotation.Transactional; import com.rjconsultores.ventaboletos.constantes.Constantes; import com.rjconsultores.ventaboletos.dao.BoletoDAO; import com.rjconsultores.ventaboletos.entidad.Boleto; +import com.rjconsultores.ventaboletos.entidad.PtoVtaSeguro; import com.rjconsultores.ventaboletos.entidad.PuntoVenta; import com.rjconsultores.ventaboletos.entidad.RutaCombinacion; import com.rjconsultores.ventaboletos.entidad.Usuario; @@ -58,15 +59,14 @@ public class BoletoServiceImpl implements BoletoService { @Transactional public void criaBoletoReserva(String unoAsientoSelec, Integer unaCorridaId, Date unaFecCorrida, Integer unoTerminalOrigenId, Integer unoTerminalDestinoId, Integer unoTipoVenta, Integer unaCategoriaSelec, - String unoNumeOperacion, Integer unUsuarioId, Integer unPuntoVenta, - Integer unClienteId, Integer rutaId, Float tarifa, Long tempoReserva, - Integer estacionId, String docCPF, String numFidelidade, Integer claseservicioId, Short marcaId, Date fecViaje, Integer empresaCorridaId, String nombPassageiro) throws Exception { + String unoNumeOperacion, Integer unUsuarioId, Integer unPuntoVenta, Integer unClienteId, Integer rutaId, + BigDecimal tarifa, Long tempoReserva, Integer estacionId, String docCPF, String numFidelidade, Integer claseservicioId, + Short marcaId, Date fecViaje, Integer empresaCorridaId, String nombPassageiro, BigDecimal valorSeguro, + BigDecimal valorTaxaEmbarque, BigDecimal valorPedagio) throws Exception { PuntoVenta miPuntoVenta = puntoVentaService.obtenerID(unPuntoVenta.intValue()); - Boleto miBoletoTemporal = new Boleto(); - BigDecimal miPrecio = MoneyHelper.arredondar(tarifa) ; - miBoletoTemporal = new Boleto(); + atualizaValoresTarifaPedagioSeguroTaxaEmbarque(tarifa, empresaCorridaId, valorSeguro, valorTaxaEmbarque, valorPedagio, miPuntoVenta, miBoletoTemporal); miBoletoTemporal.setBoletoId(formataBoletoId(getSequenciaBoletoId())); miBoletoTemporal.setBoletooriginalId(miBoletoTemporal.getBoletoId()); // Sempre Categoria Normal (1) @@ -94,9 +94,6 @@ public class BoletoServiceImpl implements BoletoService { miBoletoTemporal.setIndreplica(Boolean.FALSE); miBoletoTemporal.setIndstatusboleto("S"); miBoletoTemporal.setIndreimpresion(Boolean.FALSE); - miBoletoTemporal.setImportetaxaembarque(BigDecimal.ZERO); - miBoletoTemporal.setImporteseguro(BigDecimal.ZERO); - miBoletoTemporal.setImportepedagio(BigDecimal.ZERO); miBoletoTemporal.setImporteoutros(BigDecimal.ZERO); miBoletoTemporal.setMarcaId(marcaId); miBoletoTemporal.setMonedaId(1); @@ -111,8 +108,6 @@ public class BoletoServiceImpl implements BoletoService { miBoletoTemporal.setOrigenId(unoTerminalOrigenId); miBoletoTemporal.setPreciopricing(BigDecimal.ZERO); miBoletoTemporal.setPorccategoria(null); - miBoletoTemporal.setPreciopagado(miPrecio); - miBoletoTemporal.setPreciobase(miPrecio); miBoletoTemporal.setPuntoVenta(miPuntoVenta); miBoletoTemporal.setPtovtaventaId(miPuntoVenta.getPuntoventaId()); miBoletoTemporal.setRutaId(rutaId); @@ -127,6 +122,39 @@ public class BoletoServiceImpl implements BoletoService { } + /** + * Verifica e atualiza valores tarifa, pedágio, seguro e taxa de embarque. + * Sendo que o seguro e taxa de embarque somente serão setados caso no ponto de venda marcado como vende default. + * @param tarifa + * @param empresaCorridaId + * @param valorSeguro + * @param valorTaxaEmbarque + * @param valorPedagio + * @param miPuntoVenta + * @param miBoletoTemporal + */ + private void atualizaValoresTarifaPedagioSeguroTaxaEmbarque(BigDecimal tarifa, Integer empresaCorridaId, BigDecimal valorSeguro, + BigDecimal valorTaxaEmbarque, BigDecimal valorPedagio, PuntoVenta miPuntoVenta, Boleto miBoletoTemporal) { + BigDecimal miPrecio = MoneyHelper.arredondar(tarifa) ; + miBoletoTemporal.setImportepedagio(valorPedagio); + miBoletoTemporal.setPreciopagado(miPrecio); + miBoletoTemporal.setPreciobase(miPrecio); + if(miPuntoVenta !=null && miPuntoVenta.getPtovtaSeguroList() !=null) { + for (PtoVtaSeguro ptoVtaSeguro : miPuntoVenta.getPtovtaSeguroList()) { + if(empresaCorridaId.equals(ptoVtaSeguro.getEmpresa().getEmpresaId()) && Boolean.TRUE.equals(miPuntoVenta.getActivo())) { + if(Boolean.TRUE.equals(ptoVtaSeguro.getIndEstanTasaEmbarque())) { + miBoletoTemporal.setImportetaxaembarque(valorTaxaEmbarque); + } + if(Boolean.TRUE.equals(ptoVtaSeguro.getIndEstanSegTabela())) { + miBoletoTemporal.setImporteseguro(valorSeguro); + } + break; + } + + } + } + } + public BigDecimal calcularKmViaje(int rutaId, Integer unoOrigenId, Integer unoDestinoId) { RutaCombinacion rutaCombinacion = rutaCombinacionService.busquedaTramoRutaOrigemDestino(rutaId, unoOrigenId, unoDestinoId); return rutaCombinacion.getTramo().getKmReal(); diff --git a/src/com/rjconsultores/ventaboletos/service/impl/CategoriaCtrlServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/CategoriaCtrlServiceImpl.java index d493d7c5b..3a594be6c 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/CategoriaCtrlServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/CategoriaCtrlServiceImpl.java @@ -70,7 +70,7 @@ public class CategoriaCtrlServiceImpl implements CategoriaCtrlService { * @param categoriaCtrl */ @Override - public CategoriaCtrl checarCategoriaAdulto(CategoriaCtrl categoriaCtrl) { + public CategoriaCtrl checarCategoriaAdulto(CategoriaCtrl categoriaCtrl, Boolean rdVendeAbertoSim, Boolean chkCancelaEmAberto, Boolean chkDevolveEmAberto, Boolean chkCancelaEmergencialEmAberto, Boolean chkTrocaTiturlidadeEmAberto, Boolean chkTrocaEmAberto) { boolean existeAdulto = false; List lsCategorias = new ArrayList(); lsCategorias.addAll(categoriaCtrl.getCategoriaDescuentoList()); @@ -82,6 +82,24 @@ public class CategoriaCtrlServiceImpl implements CategoriaCtrlService { } if (!existeAdulto) { CategoriaDescuento categoriaDescuentoAdulto = this.getCategoriaDescuentoAdulto(categoriaCtrl); + + categoriaDescuentoAdulto.setIndVentaAbierto(rdVendeAbertoSim); + + if(rdVendeAbertoSim) { + //Aberto Vendido + categoriaDescuentoAdulto.setIndCancelaEmAberto(chkCancelaEmAberto); + categoriaDescuentoAdulto.setIndDevolveEmAberto(chkDevolveEmAberto); + categoriaDescuentoAdulto.setIndCancelaEmergencialEmAberto(chkCancelaEmergencialEmAberto); + categoriaDescuentoAdulto.setIndTrocaTitularidadeEmAberto(chkTrocaTiturlidadeEmAberto); + categoriaDescuentoAdulto.setIndTrocaEmAberto(chkTrocaEmAberto); + } else { + categoriaDescuentoAdulto.setIndCancelaEmAberto(false); + categoriaDescuentoAdulto.setIndDevolveEmAberto(false); + categoriaDescuentoAdulto.setIndCancelaEmergencialEmAberto(false); + categoriaDescuentoAdulto.setIndTrocaTitularidadeEmAberto(false); + categoriaDescuentoAdulto.setIndTrocaEmAberto(false); + } + lsCategorias.add(categoriaDescuentoAdulto); } categoriaCtrl.setCategoriaDescuentoList(lsCategorias); diff --git a/src/com/rjconsultores/ventaboletos/service/impl/CoeficienteTarifaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/CoeficienteTarifaServiceImpl.java index 136f62ab2..8d771db86 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/CoeficienteTarifaServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/CoeficienteTarifaServiceImpl.java @@ -3,6 +3,7 @@ package com.rjconsultores.ventaboletos.service.impl; import java.util.Calendar; import java.util.List; +import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -10,7 +11,11 @@ import org.springframework.transaction.annotation.Transactional; import com.rjconsultores.ventaboletos.dao.CoeficienteTarifaDAO; import com.rjconsultores.ventaboletos.dao.OrgaoTramoDAO; import com.rjconsultores.ventaboletos.entidad.CoeficienteTarifa; +import com.rjconsultores.ventaboletos.entidad.EsquemaCorrida; +import com.rjconsultores.ventaboletos.entidad.FormaPago; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; import com.rjconsultores.ventaboletos.service.CoeficienteTarifaService; +import com.rjconsultores.ventaboletos.service.LogAuditoriaService; import com.rjconsultores.ventaboletos.utilerias.RegistroConDependenciaException; import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; @@ -21,13 +26,26 @@ public class CoeficienteTarifaServiceImpl implements CoeficienteTarifaService { private CoeficienteTarifaDAO coeficienteTarifaDAO; @Autowired private OrgaoTramoDAO orgaoTramoDAO; + @Autowired + private LogAuditoriaService logAuditoriaService; + private static Logger log = Logger.getLogger(OrgaoConcedenteServiceImpl.class); + public List obtenerTodos() { return coeficienteTarifaDAO.obtenerTodos(); } public CoeficienteTarifa obtenerID(Integer id) { - return coeficienteTarifaDAO.obtenerID(id); + + CoeficienteTarifa coeficienteTarifa = coeficienteTarifaDAO.obtenerID(id); + + try { + coeficienteTarifa.clonar(); + } catch (Exception e) { + log.error(e.getMessage(), e); + } + return coeficienteTarifa; + } @Transactional @@ -36,16 +54,33 @@ public class CoeficienteTarifaServiceImpl implements CoeficienteTarifaService { entidad.setFecmodif(Calendar.getInstance().getTime()); entidad.setActivo(Boolean.TRUE); - return coeficienteTarifaDAO.suscribir(entidad); + + entidad = coeficienteTarifaDAO.suscribir(entidad); + logAuditoriaService.auditar(null, entidad, null); + return entidad; } @Transactional public CoeficienteTarifa actualizacion(CoeficienteTarifa entidad) { - entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); - entidad.setFecmodif(Calendar.getInstance().getTime()); - entidad.setActivo(Boolean.TRUE); + + + try { + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); + + CoeficienteTarifa originalClone = entidad.getCloneObject(); + entidad = coeficienteTarifaDAO.actualizacion(entidad); + + logAuditoriaService.auditar(originalClone, entidad, null); - return coeficienteTarifaDAO.actualizacion(entidad); + + } catch (Exception e) { + log.error(e); + } + + return entidad; } @Transactional @@ -62,8 +97,9 @@ public class CoeficienteTarifaServiceImpl implements CoeficienteTarifaService { entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); entidad.setFecmodif(Calendar.getInstance().getTime()); entidad.setActivo(Boolean.FALSE); - - coeficienteTarifaDAO.actualizacion(entidad); + + entidad = coeficienteTarifaDAO.actualizacion(entidad); + logAuditoriaService.auditarExclusao(entidad, null); } public List buscar(String nomb) { diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ConexionRutaCombinacionServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ConexionRutaCombinacionServiceImpl.java index 87b1af738..16164e4c0 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/ConexionRutaCombinacionServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/ConexionRutaCombinacionServiceImpl.java @@ -14,9 +14,11 @@ import java.util.TreeSet; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import com.rjconsultores.ventaboletos.dao.ParadaDAO; import com.rjconsultores.ventaboletos.entidad.Parada; import com.rjconsultores.ventaboletos.entidad.Ruta; import com.rjconsultores.ventaboletos.service.ConexionRutaCombinacionService; +import com.rjconsultores.ventaboletos.service.ParadaService; import com.rjconsultores.ventaboletos.service.RutaCombinacionService; import com.rjconsultores.ventaboletos.vo.conexion.OrdenarLocalidadesGeradas; import com.rjconsultores.ventaboletos.vo.parada.ConexionCtrlVO; @@ -28,6 +30,9 @@ public class ConexionRutaCombinacionServiceImpl implements ConexionRutaCombinaci @Autowired private RutaCombinacionService rutaCombinacionService; + + @Autowired + private ParadaService paradaService; private Map criandoCacheLocalidades(List list) { Map cacheLocalidades = new HashMap(); @@ -258,6 +263,20 @@ public class ConexionRutaCombinacionServiceImpl implements ConexionRutaCombinaci localidades.addAll(listParada2); localidades.addAll(listParada3); localidades.addAll(listParada4); + List localidadesAux = new ArrayList(); + localidadesAux.addAll(localidades); + for (Parada parada : localidadesAux) { + if(parada.getAgrupamentoParada() !=null) { + List paradaAgrupamentoList = paradaService.buscarPorAgrupamentoParadaId(parada.getAgrupamentoParada()); + if(paradaAgrupamentoList!=null && !paradaAgrupamentoList.isEmpty()) { + for (Parada paradaAgrupamento : paradaAgrupamentoList) { + if(!localidades.contains(paradaAgrupamento)) { + localidades.add(paradaAgrupamento); + } + } + } + } + } Map cacheLocalidades = criandoCacheLocalidades(localidades); gerarCombinacao(lists, rutasEixoA, rutasEixoB, null, localidadesGeradas, conexoesCtrl, cacheLocalidades); diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ConexionRutaTramoCtrlServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ConexionRutaTramoCtrlServiceImpl.java index 7f64e39b2..1bc4bd16f 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/ConexionRutaTramoCtrlServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/ConexionRutaTramoCtrlServiceImpl.java @@ -10,13 +10,21 @@ import org.springframework.transaction.annotation.Transactional; import com.rjconsultores.ventaboletos.dao.ConexionRutaTramoCtrlDAO; import com.rjconsultores.ventaboletos.entidad.ConexionRutaCtrl; import com.rjconsultores.ventaboletos.entidad.ConexionRutaTramoCtrl; +import com.rjconsultores.ventaboletos.entidad.Empresa; import com.rjconsultores.ventaboletos.entidad.Parada; import com.rjconsultores.ventaboletos.service.ConexionRutaTramoCtrlService; import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; +/** + * @author valdevir.silva + * + */ @Service("conexionRutaTramoCtrlService") public class ConexionRutaTramoCtrlServiceImpl implements ConexionRutaTramoCtrlService { + private static final char EIXO_C = 'C'; + private static final char EIXO_B = 'B'; + private static final char EIXO_A = 'A'; @Autowired private ConexionRutaTramoCtrlDAO conexionRutaTramoCtrlDAO; @@ -80,19 +88,40 @@ public class ConexionRutaTramoCtrlServiceImpl implements ConexionRutaTramoCtrlSe return conexionRutaTramoCtrlDAO.validarConexioneRutasExistentes(rutaOrigenId, rutaDestinoId, rutaDestinoCId, paradaOrigenId, paradaDestinoId, origemTrechoId, destinoTrechoId); } + /** + *Busca localidades cadastradas para Eixo A + */ @Override - public List buscarLocalidadesOrigem(Integer conexionRutaConfId) { - return conexionRutaTramoCtrlDAO.buscarPorConexionRutaConf(conexionRutaConfId, 'A'); + public List buscarLocalidadesEixoA(Integer conexionRutaConfId) { + return validaAgrupamentoLocalidade(conexionRutaTramoCtrlDAO.buscarLocalidadesPorConexionRutaConfAndEixo(conexionRutaConfId, EIXO_A)); + + } + + public List validaAgrupamentoLocalidade(List localidadesList){ + for (Parada parada : localidadesList) { + if(parada.getAgrupamentoParada()!=null) { + parada.setDescparada(parada.getAgrupamentoParada().getDescAgrupamentoParada()); + parada.setCveparada(parada.getAgrupamentoParada().getCveAgrupamentoParada()); + } + } + return localidadesList; } + + /** + *Busca localidades castradas para Eixo B + */ @Override - public List buscarLocalidadesDestino(Integer conexionRutaConfId) { - return conexionRutaTramoCtrlDAO.buscarPorConexionRutaConf(conexionRutaConfId, 'B'); + public List buscarLocalidadeEixoB(Integer conexionRutaConfId) { + return validaAgrupamentoLocalidade(conexionRutaTramoCtrlDAO.buscarLocalidadesPorConexionRutaConfAndEixo(conexionRutaConfId, EIXO_B)); } + /** + *Busca localidades cadastradas para Eixo C + */ @Override - public List buscarLocalidadesDestinoC(Integer conexionRutaConfId) { - return conexionRutaTramoCtrlDAO.buscarPorConexionRutaConf(conexionRutaConfId, 'C'); + public List buscarLocalidadesEixoC(Integer conexionRutaConfId) { + return validaAgrupamentoLocalidade(conexionRutaTramoCtrlDAO.buscarLocalidadesPorConexionRutaConfAndEixo(conexionRutaConfId, EIXO_C)); } @Override diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ConexionServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ConexionServiceImpl.java index 66f580703..2ea615f59 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/ConexionServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/ConexionServiceImpl.java @@ -31,8 +31,8 @@ public class ConexionServiceImpl implements ConexionService { } @Override - public List buscarConexiones(Integer origenId, Integer destinoId) { - return conexionDAO.buscarConexiones(origenId, destinoId); + public List buscarConexiones(boolean isBuscaAgrupada, Integer origenId, Integer destinoId) { + return conexionDAO.buscarConexiones(isBuscaAgrupada, origenId, destinoId); } @Override diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ConferenciaComissaoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ConferenciaComissaoServiceImpl.java index 9b8231160..dc1b5e984 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/ConferenciaComissaoServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/ConferenciaComissaoServiceImpl.java @@ -424,7 +424,7 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic public boolean isEventosFinanceirosSemConferencia(List lsEventosFinanceiros) throws BusinessException { for (EventosFinanceirosVO eventosFinanceiros : lsEventosFinanceiros) { if ((eventosFinanceiros.isExigeConferencia() || eventosFinanceiros.getExigeConferenciaAba()) && - (!eventosFinanceiros.isConferido() && eventosFinanceiros.getLogconferenciaId() == null)) { + (!eventosFinanceiros.isConferido() && (eventosFinanceiros.getLogconferenciaId() == null || eventosFinanceiros.getLogconferenciaId() == 0))) { return true; } } diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ConstanteServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ConstanteServiceImpl.java index 7ffb7d733..48f1e2071 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/ConstanteServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/ConstanteServiceImpl.java @@ -29,6 +29,7 @@ public class ConstanteServiceImpl implements ConstanteService { public static final String URL_PAINEL_BPE = "URL_PAINEL_BPE"; public static final String URL_API = "URL_API"; + public static final String URL_API_EMB = "URL_API_EMB"; public List obtenerTodos() { return constanteDAO.obtenerTodos(); @@ -142,6 +143,16 @@ public class ConstanteServiceImpl implements ConstanteService { return ""; } + return constante.getValorconstante(); + } + @Override + public String buscarURLAPIEmb(){ + Constante constante = constanteDAO.buscarPorNomeConstante(URL_API_EMB); + + if (constante == null) { + return ""; + } + return constante.getValorconstante(); } } diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ControleSerieEmbarcadaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ControleSerieEmbarcadaServiceImpl.java index 45ff6b92f..99129233b 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/ControleSerieEmbarcadaServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/ControleSerieEmbarcadaServiceImpl.java @@ -53,16 +53,23 @@ public class ControleSerieEmbarcadaServiceImpl implements ControleSerieEmbarcada // Caso não haja reaproveitamento de série, devo buscar a próxima série disponível na sequência padrão if (serieembarcada == null) { log.info("BuscarSerieEmbarcada :: Reaproveitamento nao disponivel"); - + Integer serieVlmax, SerieEmbarcada, serieBpe, serie, serieBpeSeq; CtrlSerieBPe ctrlSerieBpe = ctrlSerieBPeDAO.buscarPorEmpresaEstado(controleSerieEmbarcada.getEmpresa().getEmpresaId(), controleSerieEmbarcada.getEstado().getEstadoId()); - - Integer serie = (ctrlSerieBpe == null ? 1 : Integer.valueOf(ctrlSerieBpe.getSerie()) + 1); + if( ctrlSerieBpe == null || ctrlSerieBpe.getSerie() == null ) { + log.info(String.format("BuscarSerieEmbarcada :: Serie não encontrada para Empresa:%s Estado:%s" , controleSerieEmbarcada.getEmpresa().getEmpresaId(),controleSerieEmbarcada.getEstado())); + throw new RuntimeException( String.format("Serie não encontrada para Empresa:%s Estado:%s" , controleSerieEmbarcada.getEmpresa().getEmpresaId(),controleSerieEmbarcada.getEstado()) ); + } + + serieBpe = Integer.valueOf(ctrlSerieBpe.getSerie()); + SerieEmbarcada = ctrlSerieBPeDAO.buscarSerieEmb(controleSerieEmbarcada.getEmpresa().getEmpresaId(), controleSerieEmbarcada.getEstado().getEstadoId().toString()); + serieVlmax = (serieBpe < SerieEmbarcada ? SerieEmbarcada : serieBpe); + serie = (serieVlmax == null ? 1 : serieVlmax + 1); log.info(String.format("BuscarSerieEmbarcada :: Serie em uso [%d]", serie)); ctrlSerieBPeDAO.gerarSeqSerieBPe(controleSerieEmbarcada.getEmpresa().getEmpresaId(), controleSerieEmbarcada.getEstado().getCveestado(), serie); - - serie = ctrlSerieBPeDAO.buscarSequencia(controleSerieEmbarcada.getEmpresa().getEmpresaId(), controleSerieEmbarcada.getEstado().getCveestado()); + serieBpeSeq = ctrlSerieBPeDAO.buscarSequencia(controleSerieEmbarcada.getEmpresa().getEmpresaId(), controleSerieEmbarcada.getEstado().getCveestado()); + serie = (serie <= serieBpeSeq ? serieBpeSeq : serie); log.info(String.format("BuscarSerieEmbarcada :: Serie selecionada [%d]", serie)); diff --git a/src/com/rjconsultores/ventaboletos/service/impl/CorridaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/CorridaServiceImpl.java index 8b155b2da..e2e80e21b 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/CorridaServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/CorridaServiceImpl.java @@ -4,6 +4,7 @@ */ package com.rjconsultores.ventaboletos.service.impl; +import java.math.BigDecimal; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; @@ -768,7 +769,7 @@ public class CorridaServiceImpl implements CorridaService { } } - } catch (org.springframework.dao.DataIntegrityViolationException ex) { + } catch (Exception ex) { log.error("", ex); } @@ -1060,7 +1061,7 @@ public class CorridaServiceImpl implements CorridaService { for (CorridaTramo corridaTramo : corrida.getCorridaTramoList()) { //(Se origem corridatramo = origem cadastrada && destino corridatramo = destino cadastrado) - // ou (se origem corridatramo = destino do cadastrado), tendo em vista que corridatramo são a sequencias e não as combinações + // ou (se origem corridatramo = destino do cadastrado), tendo em vista que corridatramo são as sequencias e não as combinações if(corridaTramo.getOrigem()!=null && corridaTramo.getOrigem().getParadaId().intValue()==unoTerminalOrigenId.intValue() && corridaTramo.getDestino()!=null && corridaTramo.getDestino().getParadaId().intValue()==unoTerminalDestinoId.intValue()) { fecViaje = corridaTramo.getFechorsalidaH(); @@ -1082,14 +1083,18 @@ public class CorridaServiceImpl implements CorridaService { log.error("Reserva não será realizada. Não foi encontrado Tarifa com Origem:" + unoTerminalOrigenId + " Destino:" +unoTerminalDestinoId + " para a corrida:" + corrida.getId().getCorridaId()); continue; } - Float valorTarifa= tarifa!=null ? tarifa.getPrecio().floatValue() : null ; + BigDecimal valorTarifa= tarifa!=null ? tarifa.getPrecio() : null ; + BigDecimal valorSeguro= tarifa!=null ? tarifa.getImporteseguro() : null ; + BigDecimal valorTaxaEmbarque= tarifa!=null ? tarifa.getImportetaxaembarque() : null ; + BigDecimal valorPedagio = tarifa!=null ? tarifa.getImportepedagio() : null ; Long tempoReserva = null; Cliente cliente = clienteService.obtenerID(reservaEspecialCliente.getClienteId().intValue()); boletoService.criaBoletoReserva(unoAsientoSelec, unaCorridaId, unaFecCorrida, unoTerminalOrigenId, unoTerminalDestinoId, unoTipoVenta, unaCategoriaSelec, unoNumeOperacion, unUsuarioId, unPuntoVenta, reservaEspecialCliente.getClienteId().intValue(), corrida.getRuta().getRutaId(), valorTarifa, tempoReserva, estacionId, cliente.getNumIdentificaUno(), cliente.getListClienteFidelidad().get(0).getClienteFidelidadId().toString(), - corrida.getClaseServicio().getClaseservicioId(), corrida.getMarca().getMarcaId(), fecViaje, corrida.getEmpresa().getEmpresaId(), cliente.getNombcliente()); + corrida.getClaseServicio().getClaseservicioId(), corrida.getMarca().getMarcaId(), fecViaje, corrida.getEmpresa().getEmpresaId(), + cliente.getNombcliente(), valorSeguro, valorTaxaEmbarque, valorPedagio); } } } @@ -1295,7 +1300,7 @@ public class CorridaServiceImpl implements CorridaService { log.info("commit bloco corridas"); transactionManager.commit(status); status = transactionManager.getTransaction(def); - } catch (Throwable ex) { + } catch (Exception ex) { log.error("", ex); log.error(" Erro ao gerar corrida = " + esquemaCorrida.getNumCorrida() + " esquemaCorrida = " + esquemaCorrida.getEsquemacorridaId()); transactionManager.rollback(status); diff --git a/src/com/rjconsultores/ventaboletos/service/impl/EmpresaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/EmpresaServiceImpl.java index ff4ba511f..352ed5e62 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/EmpresaServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/EmpresaServiceImpl.java @@ -7,6 +7,7 @@ package com.rjconsultores.ventaboletos.service.impl; import java.util.Calendar; import java.util.List; +import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -24,6 +25,7 @@ import com.rjconsultores.ventaboletos.entidad.Marca; import com.rjconsultores.ventaboletos.entidad.PuntoVenta; import com.rjconsultores.ventaboletos.exception.BusinessException; import com.rjconsultores.ventaboletos.service.EmpresaService; +import com.rjconsultores.ventaboletos.service.LogAuditoriaService; import com.rjconsultores.ventaboletos.service.MarcaService; import com.rjconsultores.ventaboletos.utilerias.RegistroConDependenciaException; import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; @@ -46,13 +48,25 @@ public class EmpresaServiceImpl implements EmpresaService { @Autowired private EsquemaCorridaDAO esquemaCorridaDAO; + @Autowired + private LogAuditoriaService logAuditoriaService; + private static Logger log = Logger.getLogger(EmpresaServiceImpl.class); + public List obtenerTodos() { return empresaDAO.obtenerTodos(); } public Empresa obtenerID(Integer id) { - return empresaDAO.obtenerID(id); + + Empresa empresa = empresaDAO.obtenerID(id); + try { + empresa.clonar(); + } catch (Exception e) { + log.error(e.getMessage(), e); + } + return empresa; + } @Transactional @@ -69,11 +83,19 @@ public class EmpresaServiceImpl implements EmpresaService { if (entidad.getEmpresaId() == null) { entidad = empresaDAO.suscribir(entidad); + logAuditoriaService.auditar(null, entidad, null); + gerarMarca(entidad); } else { - entidad = empresaDAO.actualizacion(entidad); + try { + Empresa empresaClone = entidad.getCloneObject(); + entidad = empresaDAO.actualizacion(entidad); + logAuditoriaService.auditar(empresaClone, entidad, entidad.getEmpresaId()); + } catch (Exception e) { + log.error(e); + } } if (comEmpConferencia != null) { @@ -107,6 +129,8 @@ public class EmpresaServiceImpl implements EmpresaService { entidad.setActivo(Boolean.FALSE); empresaDAO.actualizacion(entidad); + logAuditoriaService.auditarExclusao(entidad,null); + } public List buscar(String nombempresa, Boolean indExterna, Short indTipo) { diff --git a/src/com/rjconsultores/ventaboletos/service/impl/FechamentoParamptovtaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/FechamentoParamptovtaServiceImpl.java index 8d1163706..cc4934f4a 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/FechamentoParamptovtaServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/FechamentoParamptovtaServiceImpl.java @@ -3,6 +3,7 @@ package com.rjconsultores.ventaboletos.service.impl; import java.util.Date; import java.util.List; +import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -12,12 +13,17 @@ import com.rjconsultores.ventaboletos.entidad.Empresa; import com.rjconsultores.ventaboletos.entidad.FechamentoParamptovta; import com.rjconsultores.ventaboletos.entidad.PuntoVenta; import com.rjconsultores.ventaboletos.service.FechamentoParamptovtaService; +import com.rjconsultores.ventaboletos.service.LogAuditoriaService; @Service("fechamentoParamptovtaService") public class FechamentoParamptovtaServiceImpl implements FechamentoParamptovtaService { @Autowired private FechamentoParamptovtaDAO fechamentoParamptovtaDAO; + @Autowired + private LogAuditoriaService logAuditoriaService; + private static Logger log = Logger.getLogger(FechamentoParamptovtaServiceImpl.class); + @Override public List obtenerTodos() { @@ -26,26 +32,47 @@ public class FechamentoParamptovtaServiceImpl implements FechamentoParamptovtaSe @Override public FechamentoParamptovta obtenerID(Long id) { - return fechamentoParamptovtaDAO.obtenerID(id); + + FechamentoParamptovta fechamentoParamptovta = fechamentoParamptovtaDAO.obtenerID(id); + try { + fechamentoParamptovta.clonar(); + } catch (Exception e) { + log.error(e.getMessage(), e); + } + return fechamentoParamptovta; + } @Override @Transactional public FechamentoParamptovta suscribir(FechamentoParamptovta entidad) { - return fechamentoParamptovtaDAO.suscribir(entidad); + + fechamentoParamptovtaDAO.suscribir(entidad); + logAuditoriaService.auditar(null, entidad, entidad.getEmpresa() != null && entidad.getEmpresa() != null ? entidad.getEmpresa().getEmpresaId() : null); + return entidad; } @Override @Transactional public FechamentoParamptovta actualizacion(FechamentoParamptovta entidad) { entidad.setFecmodif(new Date()); - return fechamentoParamptovtaDAO.actualizacion(entidad); + FechamentoParamptovta originalClone = null; + try { + originalClone = entidad.getCloneObject(); + } catch (Exception e) { + log.error("",e); + } + fechamentoParamptovtaDAO.actualizacion(entidad); + logAuditoriaService.auditar(originalClone, entidad, entidad.getEmpresa() != null ? entidad.getEmpresa().getEmpresaId() : null); + return entidad; } @Override @Transactional public void borrar(FechamentoParamptovta entidad) { + fechamentoParamptovtaDAO.borrar(entidad); + logAuditoriaService.auditarExclusao(entidad, entidad.getEmpresa() != null && entidad.getEmpresa() != null ? entidad.getEmpresa().getEmpresaId() : null); } diff --git a/src/com/rjconsultores/ventaboletos/service/impl/FormaPagoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/FormaPagoServiceImpl.java index 1dcce15a8..c398a7859 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/FormaPagoServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/FormaPagoServiceImpl.java @@ -4,16 +4,22 @@ */ package com.rjconsultores.ventaboletos.service.impl; -import com.rjconsultores.ventaboletos.dao.FormaPagoDAO; -import com.rjconsultores.ventaboletos.entidad.FormaPago; -import com.rjconsultores.ventaboletos.service.FormaPagoService; -import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; import java.util.Calendar; import java.util.List; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import com.rjconsultores.ventaboletos.dao.FormaPagoDAO; +import com.rjconsultores.ventaboletos.entidad.FormaPago; +import com.rjconsultores.ventaboletos.entidad.Tarifa; +import com.rjconsultores.ventaboletos.service.FormaPagoService; +import com.rjconsultores.ventaboletos.service.LogAuditoriaService; +import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; + /** * * @author Administrador @@ -25,13 +31,27 @@ public class FormaPagoServiceImpl implements FormaPagoService { @Autowired private FormaPagoDAO formaPagoDAO; + private static Logger log = LoggerFactory.getLogger(PuntoVentaServiceImpl.class); + @Autowired + private LogAuditoriaService logAuditoriaService; + public List obtenerTodos() { return formaPagoDAO.obtenerTodos(); } public FormaPago obtenerID(Short id) { - return formaPagoDAO.obtenerID(id); + + + FormaPago formaPago = formaPagoDAO.obtenerID(id); + + try { + formaPago.clonar(); + } catch (Exception e) { + log.error(e.getMessage(), e); + } + return formaPago; + } @Transactional @@ -39,17 +59,32 @@ public class FormaPagoServiceImpl implements FormaPagoService { entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); entidad.setFecmodif(Calendar.getInstance().getTime()); entidad.setActivo(Boolean.TRUE); - - return formaPagoDAO.suscribir(entidad); + + + formaPagoDAO.suscribir(entidad); + logAuditoriaService.auditar(null, entidad, null); + + return entidad; } @Transactional public FormaPago actualizacion(FormaPago entidad) { + + FormaPago originalClone = null; + try { + originalClone = entidad.getCloneObject(); + } catch (CloneNotSupportedException e) { + log.error(e.getMessage(), e); + } + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); entidad.setFecmodif(Calendar.getInstance().getTime()); entidad.setActivo(Boolean.TRUE); - - return formaPagoDAO.actualizacion(entidad); + + formaPagoDAO.actualizacion(entidad); + logAuditoriaService.auditar(originalClone, entidad, -1); + + return entidad; } @Transactional @@ -59,6 +94,7 @@ public class FormaPagoServiceImpl implements FormaPagoService { entidad.setActivo(Boolean.FALSE); formaPagoDAO.actualizacion(entidad); + logAuditoriaService.auditarExclusao(entidad, null); } public List buscarPorDescricao(String descpago) { diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ImportacaoClientesSrvpServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ImportacaoClientesSrvpServiceImpl.java index 82838b3b2..300608c6e 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/ImportacaoClientesSrvpServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/ImportacaoClientesSrvpServiceImpl.java @@ -214,9 +214,20 @@ public class ImportacaoClientesSrvpServiceImpl implements ImportacaoClientesSrvp Cell cell = cellIterator.next(); switch (cell.getColumnIndex()) { case 0: - cell.setCellType(Cell.CELL_TYPE_NUMERIC); try { - cliente.setNumfidelidade(new Long(Math.round(cell.getNumericCellValue())).toString()); + if(cell.getCellType() == Cell.CELL_TYPE_NUMERIC) { + cliente.setNumfidelidade(new Long(Math.round(cell.getNumericCellValue())).toString()); + }else { + if(StringUtils.isNotBlank(cell.getStringCellValue())) { + try { + cliente.setNumfidelidade(new Long(cell.getStringCellValue().trim().replaceAll(" ","")).toString()); + }catch (NumberFormatException e) { + cliente.setTelefone(""); + erros.append(cliente.getNumfidelidade() + " - Numero de Telefone incorreto: " + cell.getStringCellValue().trim().replaceAll(" ","").toString()); + erros.append("\n"); + } + } + } }catch(Exception e) { log.error("Erro na gravação do registro. Favor revisar",e); } @@ -230,7 +241,7 @@ public class ImportacaoClientesSrvpServiceImpl implements ImportacaoClientesSrvp cliente.setTipodoc(cell.getStringCellValue()); break; case 3: - cell.setCellType(Cell.CELL_TYPE_NUMERIC); + cell.setCellType(Cell.CELL_TYPE_STRING); String numDocString = null; try { numDocString = new Long(Math.round(cell.getNumericCellValue())).toString(); diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ImportacaoRetornoBancarioServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ImportacaoRetornoBancarioServiceImpl.java index 1316abf6c..a5241d8c7 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/ImportacaoRetornoBancarioServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/ImportacaoRetornoBancarioServiceImpl.java @@ -63,11 +63,11 @@ public class ImportacaoRetornoBancarioServiceImpl implements ImportacaoRetornoBa detalhado.append("Nao Quitado: ").append(detalhe.getNossoNumero()).append(".\n"); } } catch (SQLException se) { - detalhado.append("Ocorreu um erro no banco de dados: ").append(detalhe.getNossoNumero()); + detalhado.append("Ocorreu um erro no banco de dados: ").append(detalhe.getNossoNumero()).append(".\n"); log.error(se); erros++; } catch (RuntimeException re) { - detalhado.append(re.getMessage()); + detalhado.append(re.getMessage()).append(".\n"); log.error(re); erros++; } @@ -126,7 +126,7 @@ public class ImportacaoRetornoBancarioServiceImpl implements ImportacaoRetornoBa if(linha.startsWith("1")) { //detalhe DetalheRetornoItau detalhe = new DetalheRetornoItau(); - detalhe.setNossoNumero(linha.substring(62, 70)); + detalhe.setNossoNumero(linha.substring(85, 93)+"-"+linha.substring(93, 94)); arquivo.addTitulo(detalhe); continue; } @@ -148,11 +148,11 @@ public class ImportacaoRetornoBancarioServiceImpl implements ImportacaoRetornoBa FechamentoBoleto boleto = remessaCNABBancosDAO.obtenerFechamentoBoletoPorNossoNumero( detalhe.getNossoNumero(), empresaId ); if(boleto == null) { - throw new RuntimeException("Fechamento não encontrado para a empresa com o nosso numero: "+detalhe.getNossoNumero()+"\n"); + throw new RuntimeException("Fechamento não encontrado para a empresa com o nosso numero: "+detalhe.getNossoNumero()); } if( boleto.getIndBoletoQuitado() !=null && boleto.getIndBoletoQuitado()) { - throw new RuntimeException("Boleto já quitado para a empresa com o nosso numero: "+detalhe.getNossoNumero()+"\n"); + throw new RuntimeException("Boleto já quitado para a empresa com o nosso numero: "+detalhe.getNossoNumero()); } return remessaCNABBancosDAO.quitarFechamentoBoleto( boleto.getFechamentoboletoId(), usuarioId ); diff --git a/src/com/rjconsultores/ventaboletos/service/impl/OrgaoConcedenteServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/OrgaoConcedenteServiceImpl.java index 893df71c6..03ced7a71 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/OrgaoConcedenteServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/OrgaoConcedenteServiceImpl.java @@ -3,12 +3,14 @@ package com.rjconsultores.ventaboletos.service.impl; import java.util.Calendar; import java.util.List; +import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.rjconsultores.ventaboletos.dao.OrgaoConcedenteDAO; import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; +import com.rjconsultores.ventaboletos.service.LogAuditoriaService; import com.rjconsultores.ventaboletos.service.OrgaoConcedenteService; import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; @@ -17,13 +19,24 @@ public class OrgaoConcedenteServiceImpl implements OrgaoConcedenteService { @Autowired private OrgaoConcedenteDAO orgaoConcedenteDAO; + @Autowired + private LogAuditoriaService logAuditoriaService; + private static Logger log = Logger.getLogger(OrgaoConcedenteServiceImpl.class); public List obtenerTodos() { return orgaoConcedenteDAO.obtenerTodos(); } public OrgaoConcedente obtenerID(Integer id) { - return orgaoConcedenteDAO.obtenerID(id); + + OrgaoConcedente orgaoConcedente = orgaoConcedenteDAO.obtenerID(id); + try { + orgaoConcedente.clonar(); + } catch (Exception e) { + log.error(e.getMessage(), e); + } + return orgaoConcedente; + } @Transactional @@ -31,17 +44,30 @@ public class OrgaoConcedenteServiceImpl implements OrgaoConcedenteService { entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); entidad.setFecmodif(Calendar.getInstance().getTime()); entidad.setActivo(Boolean.TRUE); - - return orgaoConcedenteDAO.suscribir(entidad); + + orgaoConcedenteDAO.suscribir(entidad); + logAuditoriaService.auditar(null, entidad, null); + + return entidad; } @Transactional public OrgaoConcedente actualizacion(OrgaoConcedente entidad) { - entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); - entidad.setFecmodif(Calendar.getInstance().getTime()); - entidad.setActivo(Boolean.TRUE); + + try { + OrgaoConcedente originalClone = entidad.getCloneObject(); + + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + entidad.setFecmodif(Calendar.getInstance().getTime()); + entidad.setActivo(Boolean.TRUE); - return orgaoConcedenteDAO.actualizacion(entidad); + entidad = orgaoConcedenteDAO.actualizacion(entidad); + logAuditoriaService.auditar(originalClone, entidad, null); + } catch (Exception e) { + log.error(e); + } + + return entidad; } @Transactional @@ -51,6 +77,8 @@ public class OrgaoConcedenteServiceImpl implements OrgaoConcedenteService { entidad.setActivo(Boolean.FALSE); orgaoConcedenteDAO.actualizacion(entidad); + logAuditoriaService.auditarExclusao(entidad, null); + } public List buscar(String desc) { diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ParadaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ParadaServiceImpl.java index cbf190d03..135b00701 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/ParadaServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/ParadaServiceImpl.java @@ -15,6 +15,7 @@ import org.springframework.transaction.annotation.Transactional; import com.rjconsultores.ventaboletos.dao.ParadaDAO; import com.rjconsultores.ventaboletos.dao.TramoDAO; +import com.rjconsultores.ventaboletos.entidad.AgrupamentoParada; import com.rjconsultores.ventaboletos.entidad.Ciudad; import com.rjconsultores.ventaboletos.entidad.Nodo; import com.rjconsultores.ventaboletos.entidad.Parada; @@ -174,4 +175,8 @@ public class ParadaServiceImpl implements ParadaService { public List buscaParadaRegionMetropolitana(RegionMetropolitana regionMetropolitana){ return paradaDAO.buscaParadaRegionMetropolitana(regionMetropolitana); } + + public List buscarPorAgrupamentoParadaId(AgrupamentoParada agrupamentoParada){ + return paradaDAO.buscarPorAgrupamentoParadaId(agrupamentoParada); + } } diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PtovtaComissaoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PtovtaComissaoServiceImpl.java index 7330b753c..8941e1eac 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/PtovtaComissaoServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/PtovtaComissaoServiceImpl.java @@ -5,14 +5,18 @@ package com.rjconsultores.ventaboletos.service.impl; import com.rjconsultores.ventaboletos.dao.PtovtaComissaoDAO; +import com.rjconsultores.ventaboletos.entidad.Empresa; import com.rjconsultores.ventaboletos.entidad.PtovtaComissao; import com.rjconsultores.ventaboletos.entidad.PuntoVenta; +import com.rjconsultores.ventaboletos.service.LogAuditoriaService; import com.rjconsultores.ventaboletos.service.PtovtaComissaoService; import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; import java.util.Calendar; import java.util.List; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -24,15 +28,26 @@ import org.springframework.transaction.annotation.Transactional; @Service("ptovtaComissaoService") public class PtovtaComissaoServiceImpl implements PtovtaComissaoService { + private static Logger log = LoggerFactory.getLogger(PtovtaComissaoServiceImpl.class); + @Autowired private PtovtaComissaoDAO ptovtaComissaoDAO; + @Autowired + private LogAuditoriaService logAuditoriaService; public List obtenerTodos() { return ptovtaComissaoDAO.obtenerTodos(); } public PtovtaComissao obtenerID(Integer id) { - return ptovtaComissaoDAO.obtenerID(id); + + PtovtaComissao ptovtaComissao = ptovtaComissaoDAO.obtenerID(id); + try { + ptovtaComissao.clonar(); + } catch (Exception e) { + log.error(e.getMessage(), e); + } + return ptovtaComissao; } @Transactional @@ -41,16 +56,35 @@ public class PtovtaComissaoServiceImpl implements PtovtaComissaoService { entidad.setFecmodif(Calendar.getInstance().getTime()); entidad.setActivo(Boolean.TRUE); - return ptovtaComissaoDAO.suscribir(entidad); + ptovtaComissaoDAO.suscribir(entidad); + logAuditoriaService.auditar(null, entidad, entidad.getEmpresaId() != null ? entidad.getEmpresaId().getEmpresaId() : null); + + return entidad; + + } @Transactional public PtovtaComissao actualizacion(PtovtaComissao entidad) { + + + PtovtaComissao originalClone = null; + try { + originalClone = entidad.getCloneObject(); + } catch (Exception e) { + log.error("",e); + } + entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); entidad.setFecmodif(Calendar.getInstance().getTime()); entidad.setActivo(Boolean.TRUE); + + ptovtaComissaoDAO.actualizacion(entidad); + + logAuditoriaService.auditar(originalClone, entidad, entidad.getEmpresaId() != null ? entidad.getEmpresaId().getEmpresaId() : null); + + return entidad; - return ptovtaComissaoDAO.actualizacion(entidad); } @Transactional diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PtovtaTitularServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PtovtaTitularServiceImpl.java index 2691c7140..c89d55af2 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/PtovtaTitularServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/PtovtaTitularServiceImpl.java @@ -6,6 +6,7 @@ package com.rjconsultores.ventaboletos.service.impl; import com.rjconsultores.ventaboletos.dao.PtovtaTitularDAO; +import com.rjconsultores.ventaboletos.entidad.OrgaoConcedente; import com.rjconsultores.ventaboletos.entidad.PtovtaTitular; import com.rjconsultores.ventaboletos.service.PtovtaTitularService; import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; @@ -31,7 +32,14 @@ public class PtovtaTitularServiceImpl implements PtovtaTitularService { } public PtovtaTitular obtenerID(Integer id) { - return ptovtaTitularDAO.obtenerID(id); + + PtovtaTitular ptovtaTitular = ptovtaTitularDAO.obtenerID(id); + try { + ptovtaTitular.clonar(); + } catch (Exception e) { + e.printStackTrace(); + } + return ptovtaTitular; } @Transactional diff --git a/src/com/rjconsultores/ventaboletos/service/impl/PuntoVentaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/PuntoVentaServiceImpl.java index b693105f9..47dd51eb9 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/PuntoVentaServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/PuntoVentaServiceImpl.java @@ -38,6 +38,7 @@ import com.rjconsultores.ventaboletos.exception.IntegracionException; import com.rjconsultores.ventaboletos.exception.ValidacionCampoException; import com.rjconsultores.ventaboletos.service.ConstanteService; import com.rjconsultores.ventaboletos.service.EstacionService; +import com.rjconsultores.ventaboletos.service.LogAuditoriaService; import com.rjconsultores.ventaboletos.service.PuntoVentaService; import com.rjconsultores.ventaboletos.utilerias.ApplicationProperties; import com.rjconsultores.ventaboletos.utilerias.CustomEnum; @@ -82,6 +83,8 @@ public class PuntoVentaServiceImpl implements PuntoVentaService { private UsuarioUbicacionDAO usuarioUbicacionDAO; @Autowired private DataSource dataSource; + @Autowired + private LogAuditoriaService logAuditoriaService; // FIXME : Remover esse método de quem está usando. Esse método carrega muitos dados @Deprecated @@ -90,7 +93,15 @@ public class PuntoVentaServiceImpl implements PuntoVentaService { } public PuntoVenta obtenerID(Integer id) { - return puntoVentaDAO.obtenerID(id); + + PuntoVenta puntoVenta = puntoVentaDAO.obtenerID(id); + + try { + puntoVenta.clonar(); + } catch (Exception e) { + log.error(e.getMessage(), e); + } + return puntoVenta; } @Transactional(noRollbackFor = { IntegracionException.class, ValidacionCampoException.class}) @@ -161,7 +172,9 @@ public class PuntoVentaServiceImpl implements PuntoVentaService { throw (IntegracionException) respEx; } } - entidad = puntoVentaDAO.suscribir(entidad); + entidad = puntoVentaDAO.suscribir(entidad); + logAuditoriaService.auditar(null, entidad, entidad.getEmpresa() != null ? entidad.getEmpresa().getEmpresaId() : null); + // Mantis 15739 - A integração AG deve ser acionada após a persistência dos dados com sucesso. // Integração AG @@ -418,6 +431,14 @@ public class PuntoVentaServiceImpl implements PuntoVentaService { @Transactional(noRollbackFor = { IntegracionException.class, ValidacionCampoException.class}) public PuntoVenta actualizacion(PuntoVenta entidad) throws IntegracionException, ValidacionCampoException { + + PuntoVenta originalClone = null; + try { + originalClone = entidad.getCloneObject(); + originalClone.setTitularId(entidad.getTitularId().getCloneObject()); + } catch (Exception e) { + log.error("",e); + } entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); entidad.setFecmodif(Calendar.getInstance().getTime()); entidad.setActivo(Boolean.TRUE); @@ -475,7 +496,9 @@ public class PuntoVentaServiceImpl implements PuntoVentaService { } } } + entidad = puntoVentaDAO.actualizacion(entidad); + logAuditoriaService.auditar(originalClone, entidad, entidad.getEmpresa() != null ? entidad.getEmpresa().getEmpresaId() : null); if (respEx != null) { if (respEx instanceof IntegracionException) { @@ -549,6 +572,9 @@ public class PuntoVentaServiceImpl implements PuntoVentaService { entidad.setActivo(Boolean.FALSE); puntoVentaDAO.actualizacion(entidad); + + logAuditoriaService.auditarExclusao(entidad, entidad.getEmpresa() != null && entidad.getEmpresa() != null ? entidad.getEmpresa().getEmpresaId() : null); + } public List buscaLike(String strEstacion, boolean sinTodos) { diff --git a/src/com/rjconsultores/ventaboletos/service/impl/RutaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/RutaServiceImpl.java index 57bd3e17a..4d7ad79dc 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/RutaServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/RutaServiceImpl.java @@ -6,6 +6,7 @@ package com.rjconsultores.ventaboletos.service.impl; import java.util.ArrayList; import java.util.Calendar; +import java.util.Date; import java.util.HashMap; import java.util.List; @@ -234,6 +235,7 @@ public class RutaServiceImpl implements RutaService { } Boolean isClone = entidad.getIsClone() != null ? entidad.getIsClone() : Boolean.FALSE; + Boolean isCadastro = entidad.getIsCadastro(); if (entidad.getRutaId() == null) { entidad = rutaDAO.suscribir(entidad); @@ -241,7 +243,7 @@ public class RutaServiceImpl implements RutaService { entidad = rutaDAO.actualizacion(entidad); } if (lsParadasSequencia != null) { - if (!isClone) { + if (!isClone && !isCadastro) { generarSecuencias(entidad, lsParadasSequencia); } generarCombinacion(entidad); @@ -283,9 +285,10 @@ public class RutaServiceImpl implements RutaService { ClaseServicio claseServicio = ruta.getClaseServicio(); Tramo tramo = tramoService.obtenerTramoUnicoRuta(ori, des, via, claseServicio); - - if (tramo != null) { - + if (tramo == null && isCopiaComAlteracaoDeClasse(ruta)) { + tramo = tramoService.obtenerTramoUnicoRuta(ori, des, via, ruta.getClaseServicioRutaOrigem()); + } + if (tramo != null ) { RutaSecuencia rutaSecuencia = new RutaSecuencia(); rutaSecuencia.setRuta(ruta); rutaSecuencia.setTramo(tramo); @@ -295,10 +298,30 @@ public class RutaServiceImpl implements RutaService { rutaSecuencia.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); rutaSecuencia.setKmOriginal(tramo.getKmReal()); rutaSecuencia = rutaSecuenciaService.suscribir(rutaSecuencia); - - List lsRutaCaseta = rutaSecuenciaBackup.get(tramo.getTramoId()); - if( lsRutaCaseta != null && !lsRutaCaseta.isEmpty() ) { - rutaSecuencia.setLsRutaCase(lsRutaCaseta); + + List lsRutaCaseta; + if (ruta.getIsClone()) { + lsRutaCaseta = lsParadasSequencia.get(i).getCasetas(); + if (lsRutaCaseta != null && !lsRutaCaseta.isEmpty()) { + List rutasCaseta = new ArrayList(); + + for (RutaCaseta rc : lsRutaCaseta) { + RutaCaseta rutaCaseta = new RutaCaseta(); + rutaCaseta.setRutaSecuencia(rutaSecuencia); + rutaCaseta.setCasetaPeaje(rc.getCasetaPeaje()); + rutaCaseta.setActivo(Boolean.TRUE); + rutaCaseta.setFecmodif(new Date()); + rutaCaseta.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId()); + rutasCaseta.add(rutaCaseta); + } + + rutaSecuencia.setLsRutaCase(rutasCaseta); + } + } else { + lsRutaCaseta = rutaSecuenciaBackup.get(tramo.getTramoId()); + if (lsRutaCaseta != null && !lsRutaCaseta.isEmpty()) { + rutaSecuencia.setLsRutaCase(lsRutaCaseta); + } } @@ -312,6 +335,10 @@ public class RutaServiceImpl implements RutaService { } } + private boolean isCopiaComAlteracaoDeClasse(Ruta ruta) { + return ruta.getIsClone() && ruta.getClaseServicioRutaOrigem() != null && (ruta.getClaseServicioRutaOrigem().getClaseservicioId() != ruta.getClaseServicio().getClaseservicioId()); + } + @Transactional(rollbackFor = BusinessException.class) public Ruta actualizacion(Ruta ruta, List lsParadasSequencia) throws BusinessException { if (lsParadasSequencia != null) { @@ -434,9 +461,17 @@ public class RutaServiceImpl implements RutaService { } private boolean indVenta(Ruta ruta, Tramo trBuscaOrigemDestino) { - for (RutaCombinacion rc : ruta.getRutaCombinacionList()) { - if (rc.getTramo().equals(trBuscaOrigemDestino)) { - return rc.getIndventa(); + if (!ruta.getIsClone()) { + for (RutaCombinacion rc : ruta.getRutaCombinacionList()) { + if (rc.getTramo().equals(trBuscaOrigemDestino)) { + return rc.getIndventa(); + } + } + } else { + for (RutaCombinacion rcTemporaria : ruta.getRutaCombinacionTemporariaList()) { + if (rcTemporaria.getTramo().equals(trBuscaOrigemDestino)) { + return rcTemporaria.getIndventa(); + } } } return true; diff --git a/src/com/rjconsultores/ventaboletos/service/impl/SapServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/SapServiceImpl.java index 1e4a76a6f..24a35e7fe 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/SapServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/SapServiceImpl.java @@ -3,6 +3,7 @@ package com.rjconsultores.ventaboletos.service.impl; import java.util.Date; import java.util.List; +import org.apache.log4j.Logger; import org.codehaus.jettison.json.JSONObject; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -15,6 +16,7 @@ import com.rjconsultores.ventaboletos.entidad.Empresa; import com.rjconsultores.ventaboletos.entidad.FechamentoCntcorrente; import com.rjconsultores.ventaboletos.rest.IntegracaoSapRest; import com.rjconsultores.ventaboletos.service.SapService; +import com.rjconsultores.ventaboletos.utilerias.DateUtil; import com.rjconsultores.ventaboletos.vo.integracao.FechamentoCntCorrenteVO; @Service("sapService") @@ -22,6 +24,9 @@ public class SapServiceImpl implements SapService{ private static final String INTEGRACAO_SAP_URL = "INTEGRACAO_SAP_URL"; private static final String INTEGRACAO_SAP_CREDENCIAL = "INTEGRACAO_SAP_CREDENCIAL"; + private static final int INTEGRACAO_SAP_OK = 1; + private static final int INTEGRACAO_SAP_ERRO = 2; + private static Logger log = Logger.getLogger(SapServiceImpl.class); @Autowired private SapDAO sapDAO; @@ -76,12 +81,14 @@ public class SapServiceImpl implements SapService{ JSONObject integrado = integracaoSapRest.enviarIntegracaoSap(fechamentoCntcorrente, url, credenciais); if(integrado == null) { - throw new RuntimeException("Erro no envio/retorno da requisicao para integração SAP"); + atualizaFechamento(fechamentoCntcorrente.getFechamentocntcorrenteId(), INTEGRACAO_SAP_ERRO); + log.error("Erro no envio/retorno da requisicao para integração SAP do fechamentoID: "+fechamentoCntcorrente.getFechamentocntcorrenteId()); }else if(integrado.getString("Integration").equals("S")) { - atualizaFechamento(fechamentoCntcorrente.getFechamentocntcorrenteId()); + atualizaFechamento(fechamentoCntcorrente.getFechamentocntcorrenteId(), INTEGRACAO_SAP_OK); contador++; }else if(integrado.getString("Integration").equals("E")) { - throw new RuntimeException("Retorno enviado pelo SAP: \r\n"+integrado.getString("Message")); + atualizaFechamento(fechamentoCntcorrente.getFechamentocntcorrenteId(), INTEGRACAO_SAP_ERRO); + log.warn("Retorno enviado pelo SAP: \r\n"+integrado.getString("Message")); } } } @@ -94,8 +101,8 @@ public class SapServiceImpl implements SapService{ } } - private boolean atualizaFechamento(Long fechamentocntcorrenteId) throws Exception { - return sapDAO.atualizaFechamento( fechamentocntcorrenteId); + private boolean atualizaFechamento(Long fechamentocntcorrenteId, int status) throws Exception { + return sapDAO.atualizaFechamento( fechamentocntcorrenteId, status); } private String buscaConstante(String constanteString) { @@ -110,10 +117,18 @@ public class SapServiceImpl implements SapService{ @Override public void integracaoSapAutomatica() throws Exception { - List listaPendente = obtenerTodosParaRemessa(null, new Date(), new Date(), false); + List listaPendente = obtenerTodosParaRemessa(null, DateUtil.getYesterdayDate(), new Date(), false); - if(!listaPendente.isEmpty()) { - remessa(listaPendente); + while(!listaPendente.isEmpty()) { + log.info("IntegracaoSap: Registro a enviar:"+listaPendente.size()); + + try { + remessa(listaPendente); + } catch (Exception e) { + throw e; + } + + listaPendente = obtenerTodosParaRemessa(null, DateUtil.getYesterdayDate(), new Date(), false); } } diff --git a/src/com/rjconsultores/ventaboletos/service/impl/TramoRutaServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/TramoRutaServiceImpl.java index 57f24ce36..fd271840a 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/TramoRutaServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/TramoRutaServiceImpl.java @@ -397,6 +397,15 @@ public class TramoRutaServiceImpl implements TramoRutaService { nuevaSecuencia.setCoeficienteTarifa3(orgaoTramo.getCoeficienteTarifa3()); nuevaSecuencia.setKmCoeficiente3(orgaoTramo.getKmCoeficiente3()); nuevaSecuencia.setOrgaoTramoId(orgaoTramo.getOrgaoTramoId()); + } else if (IsClasseAlterada(rutaTramoVO)) { + orgaoTramo = orgaoTramoDAO.buscar(origen.getParadaId(), destino.getParadaId(), via.getViaId(), rutaTramoVO.getOrgaoConcedente().getOrgaoConcedenteId(), rutaTramoVO.getClaseServicioRutaOrigem().getClaseservicioId()); + if (orgaoTramo != null) { + nuevaSecuencia.setKmCoeficiente1(orgaoTramo.getKmCoeficiente1()); + nuevaSecuencia.setKmCoeficiente2(orgaoTramo.getKmCoeficiente2()); + nuevaSecuencia.setKmCoeficiente3(orgaoTramo.getKmCoeficiente3()); + nuevaSecuencia.setOrgaoTramoId(orgaoTramo.getOrgaoTramoId()); + nuevaSecuencia.setClaseServicioRutaOrigemUtilizadaNaPesquisa(true); + } } incluirCoeficiente(nuevaSecuencia, rutaTramoVO); } @@ -408,9 +417,21 @@ public class TramoRutaServiceImpl implements TramoRutaService { nuevaSecuencia.setTiempoRecorrido(new HoraSistema(tramoServicio.getTiemporecorrido())); nuevaSecuencia.setTramoId(tramoServicio.getTramo().getTramoId()); nuevaSecuencia.setTramoServicioId(tramoServicio.getTramoservicioId()); + } else if (IsClasseAlterada(rutaTramoVO)) { + tramoServicio = tramoServicioService.buscar(origen, destino, via, rutaTramoVO.getClaseServicioRutaOrigem()); + if (tramoServicio != null) { + nuevaSecuencia.setKmReal(tramoServicio.getTramo().getKmReal()); + nuevaSecuencia.setTiempoRecorrido(new HoraSistema(tramoServicio.getTiemporecorrido())); + nuevaSecuencia.setTramoId(tramoServicio.getTramo().getTramoId()); + nuevaSecuencia.setTramoServicioId(tramoServicio.getTramoservicioId()); + } } } + private boolean IsClasseAlterada(RutaTramoVO rutaTramoVO) { + return rutaTramoVO.getClaseServicioRutaOrigem() != null && rutaTramoVO.getClaseServicio().getClaseservicioId()!=rutaTramoVO.getClaseServicioRutaOrigem().getClaseservicioId(); + } + private void incluirCoeficiente(SecuenciaRutaTramoCoeficienteVO nuevaSecuencia, RutaTramoVO rutaTramoVO) { if (nuevaSecuencia.getKmCoeficiente1() == null && rutaTramoVO.getCoeficienteDefault1() != null) { nuevaSecuencia.setKmCoeficiente1(nuevaSecuencia.getKmReal()); @@ -532,7 +553,7 @@ public class TramoRutaServiceImpl implements TramoRutaService { } } - if (secuencia.getOrgaoTramoId() == null + if ((secuencia.getClaseServicioRutaOrigemUtilizadaNaPesquisa() || secuencia.getOrgaoTramoId() == null ) && secuencia.getCoeficienteTarifa1() != null) { OrgaoTramo orgaoTramo = new OrgaoTramo(); orgaoTramo.setClaseServicio(claseServicio); @@ -594,6 +615,16 @@ public class TramoRutaServiceImpl implements TramoRutaService { for (SecuenciaRutaTramoCoeficienteVO s : rutaTramoVO.getLsCombinacionRutaTramoVO()) { RutaCombinacion rutaCombinacion = new RutaCombinacion(); rutaCombinacion.setIndventa(s.getPermiteVenda() == null ? true : s.getPermiteVenda()); + if (ruta.getIsClone() ) { + Tramo tramoAtual = tramoService.obtenerTramotPorOrigemDestinoVia(s.getOrigen(), s.getDestino(), s.getVia()); + for (RutaCombinacion rcRuta : ruta.getRutaCombinacionList()) { + if (rcRuta.getTramo() != null && tramoAtual != null && rcRuta.getTramo().getTramoId() == tramoAtual.getTramoId()) { + rutaCombinacion.setIndventa(rcRuta.getIndventa() == null ? true : rcRuta.getIndventa()); + } + } + } + + rutaCombinacion.setRuta(ruta); rutaCombinacion.setTramo(tramoService.obtenerTramotPorOrigemDestinoVia(s.getOrigen(), s.getDestino(), s.getVia())); diff --git a/src/com/rjconsultores/ventaboletos/service/impl/UsuarioServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/UsuarioServiceImpl.java index 34f6fa709..d5d570bd8 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/UsuarioServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/UsuarioServiceImpl.java @@ -128,8 +128,11 @@ public class UsuarioServiceImpl implements UsuarioService, UserDetailsService { entidad.setFecmodif(Calendar.getInstance().getTime()); entidad.setActivo(Boolean.TRUE); - if (entidad.getUsuarioId() == null) { - return usuarioDAO.suscribir(entidad); + if (entidad.getUsuarioId() == null) { + usuarioDAO.suscribir(entidad); + logAuditoriaService.auditar(null, entidad, entidad.getEmpresa() != null && !entidad.getEmpresa().isEmpty()? entidad.getEmpresa().get(0).getEmpresaId(): null); + return entidad; + } else { entidad = usuarioDAO.actualizacion(entidad); logAuditoriaService.auditar(originalClone, entidad, entidad.getEmpresa() != null && !entidad.getEmpresa().isEmpty()? entidad.getEmpresa().get(0).getEmpresaId(): null); @@ -202,6 +205,7 @@ public class UsuarioServiceImpl implements UsuarioService, UserDetailsService { entidad.setActivo(Boolean.FALSE); usuarioDAO.actualizacion(entidad); + logAuditoriaService.auditarExclusao(entidad, entidad.getEmpresa() != null && !entidad.getEmpresa().isEmpty()? entidad.getEmpresa().get(0).getEmpresaId(): null); } public Usuario buscarPeloNomeSenha(String stUsuario, String senha) { diff --git a/src/com/rjconsultores/ventaboletos/vo/conexion/ConexionVO.java b/src/com/rjconsultores/ventaboletos/vo/conexion/ConexionVO.java index 18ed9e03f..d15f6e3d9 100644 --- a/src/com/rjconsultores/ventaboletos/vo/conexion/ConexionVO.java +++ b/src/com/rjconsultores/ventaboletos/vo/conexion/ConexionVO.java @@ -8,6 +8,8 @@ public class ConexionVO { private String tramoDestino; private Long conexionCtrlId; + private boolean buscaAgruapada; + public String getConOrigen() { return conOrigen; } @@ -56,6 +58,14 @@ public class ConexionVO { this.conexionCtrlId = conexionCtrlId; } + public boolean isBuscaAgruapada() { + return buscaAgruapada; + } + + public void setBuscaAgruapada(boolean buscaAgruapada) { + this.buscaAgruapada = buscaAgruapada; + } + @Override public String toString() { return "ConexionVO [conOrigen=" + conOrigen + ", conDestino=" + conDestino + ", grupo=" + grupo + ", tramoOrigen=" + tramoOrigen + ", tramoDestino=" + tramoDestino + ", conexionCtrlId=" + conexionCtrlId + "]"; diff --git a/src/com/rjconsultores/ventaboletos/vo/esquemaoperacional/RutaTramoVO.java b/src/com/rjconsultores/ventaboletos/vo/esquemaoperacional/RutaTramoVO.java index 3ff0f6d72..c8c58afd2 100644 --- a/src/com/rjconsultores/ventaboletos/vo/esquemaoperacional/RutaTramoVO.java +++ b/src/com/rjconsultores/ventaboletos/vo/esquemaoperacional/RutaTramoVO.java @@ -19,6 +19,7 @@ public class RutaTramoVO { private Boolean ventaHandHeld; private Boolean solicitaNombrePasajero; private ClaseServicio claseServicio; + private ClaseServicio claseServicioRutaOrigem; private OrgaoConcedente orgaoConcedente; private List lsSecuenciaRutaTramoVO; private List lsCombinacionRutaTramoVO; @@ -169,6 +170,16 @@ public class RutaTramoVO { this.lsParadaSecuenciaCombinacaoLinhas = lsParadaSecuenciaCombinacaoLinhas; } + + + public ClaseServicio getClaseServicioRutaOrigem() { + return claseServicioRutaOrigem; + } + + public void setClaseServicioRutaOrigem(ClaseServicio claseServicioRutaOrigem) { + this.claseServicioRutaOrigem = claseServicioRutaOrigem; + } + public Map getParadasComKmEntradaSaida(){ Map kmEntradaSaida = new HashMap(); for (SecuenciaRutaTramoVO s : getLsSecuenciaRutaTramoVO()){ diff --git a/src/com/rjconsultores/ventaboletos/vo/esquemaoperacional/SecuenciaRutaTramoCoeficienteVO.java b/src/com/rjconsultores/ventaboletos/vo/esquemaoperacional/SecuenciaRutaTramoCoeficienteVO.java index 5d9465e9c..a9507206b 100644 --- a/src/com/rjconsultores/ventaboletos/vo/esquemaoperacional/SecuenciaRutaTramoCoeficienteVO.java +++ b/src/com/rjconsultores/ventaboletos/vo/esquemaoperacional/SecuenciaRutaTramoCoeficienteVO.java @@ -28,6 +28,7 @@ public class SecuenciaRutaTramoCoeficienteVO { private CoeficienteTarifa coeficienteTarifa3; private BigDecimal kmCoeficiente3; private Boolean permiteVenda; + private Boolean claseServicioRutaOrigemUtilizadaNaPesquisa; public SecuenciaRutaTramoCoeficienteVO(Parada origen, Parada destino, Via via, Integer secuencia, BigDecimal kmReal, HoraSistema tiempoRecorrido) { super(); @@ -259,4 +260,14 @@ public class SecuenciaRutaTramoCoeficienteVO { this.kmEntradaDestino = kmEntradaDestino; } + public Boolean getClaseServicioRutaOrigemUtilizadaNaPesquisa() { + return claseServicioRutaOrigemUtilizadaNaPesquisa==null?false:claseServicioRutaOrigemUtilizadaNaPesquisa; + } + + public void setClaseServicioRutaOrigemUtilizadaNaPesquisa(Boolean claseServicioRutaOrigemUtilizadaNaPesquisa) { + this.claseServicioRutaOrigemUtilizadaNaPesquisa = claseServicioRutaOrigemUtilizadaNaPesquisa; + } + + + }