From 9b330fdbb2d518b56362e959415eceb331d98d63 Mon Sep 17 00:00:00 2001 From: wilian Date: Thu, 27 May 2021 01:26:59 +0000 Subject: [PATCH] fixes bug#22413 fixes bug#22420 dev:wilian qua: git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@106906 d1611594-4594-4d17-8e1d-87c2c4800839 --- .../ventaboletos/dao/ConexionRutaConfDAO.java | 2 + .../ventaboletos/dao/ConexionRutaCtrlDAO.java | 2 +- .../dao/ConexionRutaTramoCtrlDAO.java | 2 +- .../ventaboletos/dao/RutaCombinacionDAO.java | 2 + .../ConexionRutaConfHibernateDAO.java | 96 ++++++++++++++++++- .../ConexionRutaCtrlHibernateDAO.java | 2 +- .../ConexionRutaTramoCtrlHibernateDAO.java | 2 +- .../RutaCombinacionHibernateDAO.java | 26 +++++ .../ventaboletos/entidad/Conexion.java | 6 +- .../ventaboletos/entidad/ConexionCtrl.java | 26 ++++- .../entidad/ConexionRutaConf.java | 44 +-------- .../entidad/ConexionRutaCtrl.java | 43 ++++++--- .../entidad/ConexionRutaExcepcionPtoVta.java | 4 +- .../ConexionRutaExcepcionTipoPtoVta.java | 4 +- .../entidad/ConexionRutaTramoCtrl.java | 92 ++++++++++-------- .../ventaboletos/entidad/TipoPuntoVenta.java | 4 +- .../service/ConexionRutaConfService.java | 2 + .../service/ConexionRutaTramoCtrlService.java | 13 ++- .../service/RutaCombinacionService.java | 2 + .../impl/ConexionDescuentoServiceImpl.java | 6 +- .../impl/ConexionRutaConfServiceImpl.java | 6 ++ .../ConexionRutaTramoCtrlServiceImpl.java | 51 +++++++++- .../impl/RutaCombinacionServiceImpl.java | 5 + .../vo/parada/ConexionCtrlVO.java | 87 +++++++++++++++++ .../vo/parada/ConexionRutaCtrlVO.java | 76 +++++++++++++++ .../vo/parada/ParadaVOConexionRuta.java | 71 +++++++++++++- 26 files changed, 556 insertions(+), 120 deletions(-) create mode 100644 src/com/rjconsultores/ventaboletos/vo/parada/ConexionCtrlVO.java create mode 100644 src/com/rjconsultores/ventaboletos/vo/parada/ConexionRutaCtrlVO.java diff --git a/src/com/rjconsultores/ventaboletos/dao/ConexionRutaConfDAO.java b/src/com/rjconsultores/ventaboletos/dao/ConexionRutaConfDAO.java index 8a7f8cc55..3184dfb41 100644 --- a/src/com/rjconsultores/ventaboletos/dao/ConexionRutaConfDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/ConexionRutaConfDAO.java @@ -9,5 +9,7 @@ public interface ConexionRutaConfDAO extends GenericDAO buscarPorDescricao(String descricao); List obtenerTodosActivo(); + + public void excluirConfiguracao(ConexionRutaConf conexion, Integer usuarioId, boolean excluirConexionRutaConf); } diff --git a/src/com/rjconsultores/ventaboletos/dao/ConexionRutaCtrlDAO.java b/src/com/rjconsultores/ventaboletos/dao/ConexionRutaCtrlDAO.java index 0852101d0..6411d3e29 100644 --- a/src/com/rjconsultores/ventaboletos/dao/ConexionRutaCtrlDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/ConexionRutaCtrlDAO.java @@ -6,7 +6,7 @@ import com.rjconsultores.ventaboletos.entidad.ConexionRutaConf; import com.rjconsultores.ventaboletos.entidad.ConexionRutaCtrl; import com.rjconsultores.ventaboletos.vo.conexion.ConexionRutaVO; -public interface ConexionRutaCtrlDAO extends GenericDAO { +public interface ConexionRutaCtrlDAO extends GenericDAO { List buscarConexionesValidas(); diff --git a/src/com/rjconsultores/ventaboletos/dao/ConexionRutaTramoCtrlDAO.java b/src/com/rjconsultores/ventaboletos/dao/ConexionRutaTramoCtrlDAO.java index 0458f0b3a..254167622 100644 --- a/src/com/rjconsultores/ventaboletos/dao/ConexionRutaTramoCtrlDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/ConexionRutaTramoCtrlDAO.java @@ -5,7 +5,7 @@ import java.util.List; import com.rjconsultores.ventaboletos.entidad.ConexionRutaCtrl; import com.rjconsultores.ventaboletos.entidad.ConexionRutaTramoCtrl; -public interface ConexionRutaTramoCtrlDAO extends GenericDAO { +public interface ConexionRutaTramoCtrlDAO extends GenericDAO { boolean validarConexioneRutasExistentes(Integer rutaOrigenId, Integer rutaDestinoId, Integer paradaOrigenId, Integer paradaDestinoId, Integer origemTrechoId, Integer destinoTrechoId, Integer destinoTrechoId2); diff --git a/src/com/rjconsultores/ventaboletos/dao/RutaCombinacionDAO.java b/src/com/rjconsultores/ventaboletos/dao/RutaCombinacionDAO.java index 7ea409d49..e60037b57 100644 --- a/src/com/rjconsultores/ventaboletos/dao/RutaCombinacionDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/RutaCombinacionDAO.java @@ -82,4 +82,6 @@ public interface RutaCombinacionDAO extends GenericDAO public boolean existeTramo(Tramo tramo); public boolean existeTramo(Tramo tramo, ClaseServicio claseServicio); + + boolean isRutaCombinacionVenda(Integer rutaId, Integer origenId, Integer destinoId); } diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionRutaConfHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionRutaConfHibernateDAO.java index 33d6540ed..5b169d307 100644 --- a/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionRutaConfHibernateDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionRutaConfHibernateDAO.java @@ -1,9 +1,13 @@ package com.rjconsultores.ventaboletos.dao.hibernate; +import java.util.ArrayList; +import java.util.Calendar; import java.util.List; import org.hibernate.Criteria; +import org.hibernate.Query; import org.hibernate.SessionFactory; +import org.hibernate.criterion.MatchMode; import org.hibernate.criterion.Restrictions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; @@ -25,7 +29,7 @@ public class ConexionRutaConfHibernateDAO extends GenericHibernateDAO comandos = carregarComandosInativarConfiguracao(excluirConexionRutaConf); + for (String comando : comandos) { + Query qr = getSession().createSQLQuery(comando); + qr.setParameter("usuarioId", usuarioId); + qr.setParameter("conexionrutaconfId", conexion.getConexionRutaConfId()); + qr.setParameter("fecmodif", Calendar.getInstance().getTime()); + qr.executeUpdate(); + } + } + + private List carregarComandosInativarConfiguracao(boolean excluirConexionRutaConf) { + List comandos = new ArrayList(0); + + StringBuilder sb = new StringBuilder(); + if(excluirConexionRutaConf) { + sb.append("update conexion_ruta_conf ") + .append("set activo = 0, usuario_id = :usuarioId, fecmodif = :fecmodif ") + .append("where conexionrutaconf_id = :conexionrutaconfId"); + comandos.add(sb.toString()); + } + + sb = new StringBuilder(); + sb.append("update conexion_ruta_ctrl ") + .append("set activo = 0, usuario_id = :usuarioId, fecmodif = :fecmodif ") + .append("where conexionrutaconf_id = :conexionrutaconfId"); + comandos.add(sb.toString()); + + sb = new StringBuilder(); + sb.append("update conexion_ruta_excepcion_ptovta ") + .append("set activo = 0, usuario_id = :usuarioId, fecmodif = :fecmodif ") + .append("where conexionrutaconf_id = :conexionrutaconfId"); + comandos.add(sb.toString()); + + sb = new StringBuilder(); + sb.append("update conexion_rutaexcepciontipopta ") + .append("set activo = 0, usuario_id = :usuarioId, fecmodif = :fecmodif ") + .append("where conexionrutaconf_id = :conexionrutaconfId"); + comandos.add(sb.toString()); + + sb = new StringBuilder(); + sb.append("merge into conexion_ruta_tramo_ctrl c ") + .append("using ( ") + .append("select c1.conexionrutatramoctrl_id ") + .append("from conexion_ruta_tramo_ctrl c1 ") + .append("join conexion_ruta_ctrl c2 on c1.conexionrutactrl_id = c2.conexionrutactrl_id ") + .append("where c2.conexionrutaconf_id = :conexionrutaconfId and c1.activo = 1) t on (t.conexionrutatramoctrl_id = c.conexionrutatramoctrl_id) ") + .append("when matched then update set c.activo = 0, usuario_id = :usuarioId, fecmodif = :fecmodif "); + comandos.add(sb.toString()); + + sb = new StringBuilder(); + sb.append("merge into conexion c ") + .append("using ( ") + .append("select c.conexion_id ") + .append("from conexion c ") + .append("join conexion_ruta_tramo_ctrl c1 on c.conexionrutatramoctrl_id = c1.conexionrutatramoctrl_id ") + .append("join conexion_ruta_ctrl c2 on c1.conexionrutactrl_id = c2.conexionrutactrl_id ") + .append("where c2.conexionrutaconf_id = :conexionrutaconfId and c.activo = 1) t on (t.conexion_id = c.conexion_id) ") + .append("when matched then update set c.activo = 0, usuario_id = :usuarioId, fecmodif = :fecmodif"); + comandos.add(sb.toString()); + + sb = new StringBuilder(); + sb.append("merge into conexion_ctrl c ") + .append("using ( ") + .append("select distinct c.conexionctrl_id ") + .append("from conexion_ctrl c ") + .append("join conexion c3 on c3.conexionctrl_id = c.conexionctrl_id ") + .append("join conexion_ruta_tramo_ctrl c1 on c3.conexionrutatramoctrl_id = c1.conexionrutatramoctrl_id ") + .append("join conexion_ruta_ctrl c2 on c1.conexionrutactrl_id = c2.conexionrutactrl_id ") + .append("where c2.conexionrutaconf_id = :conexionrutaconfId and c.activo = 1) t on (t.conexionctrl_id = c.conexionctrl_id) ") + .append("when matched then update set c.activo = 0, usuario_id = :usuarioId, fecmodif = :fecmodif"); + comandos.add(sb.toString()); + + sb = new StringBuilder(); + sb.append("merge into conexion_conf c ") + .append("using ( ") + .append("select distinct c.conexionconf_id ") + .append("from conexion_conf c ") + .append("join conexion_ctrl c4 on c4.conexionctrl_id = c.conexionctrl_id ") + .append("join conexion c3 on c3.conexionctrl_id = c4.conexionctrl_id ") + .append("join conexion_ruta_tramo_ctrl c1 on c3.conexionrutatramoctrl_id = c1.conexionrutatramoctrl_id ") + .append("join conexion_ruta_ctrl c2 on c1.conexionrutactrl_id = c2.conexionrutactrl_id ") + .append("where c2.conexionrutaconf_id = :conexionrutaconfId and c.activo = 1) t on (t.conexionconf_id = c.conexionconf_id) ") + .append("when matched then update set c.activo = 0, usuario_id = :usuarioId, fecmodif = :fecmodif "); + comandos.add(sb.toString()); + + return comandos; + } + } diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionRutaCtrlHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionRutaCtrlHibernateDAO.java index 50378c64f..3187ff728 100644 --- a/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionRutaCtrlHibernateDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionRutaCtrlHibernateDAO.java @@ -18,7 +18,7 @@ import com.rjconsultores.ventaboletos.entidad.ConexionRutaCtrl; import com.rjconsultores.ventaboletos.vo.conexion.ConexionRutaVO; @Repository("conexionRutaCtrlDAO") -public class ConexionRutaCtrlHibernateDAO extends GenericHibernateDAO implements ConexionRutaCtrlDAO { +public class ConexionRutaCtrlHibernateDAO extends GenericHibernateDAO implements ConexionRutaCtrlDAO { @Autowired public ConexionRutaCtrlHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionRutaTramoCtrlHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionRutaTramoCtrlHibernateDAO.java index 957a765a2..678c40a0d 100644 --- a/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionRutaTramoCtrlHibernateDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConexionRutaTramoCtrlHibernateDAO.java @@ -15,7 +15,7 @@ import com.rjconsultores.ventaboletos.entidad.ConexionRutaCtrl; import com.rjconsultores.ventaboletos.entidad.ConexionRutaTramoCtrl; @Repository("conexionRutaTramoCtrlDAO") -public class ConexionRutaTramoCtrlHibernateDAO extends GenericHibernateDAO implements ConexionRutaTramoCtrlDAO { +public class ConexionRutaTramoCtrlHibernateDAO extends GenericHibernateDAO implements ConexionRutaTramoCtrlDAO { @Autowired public ConexionRutaTramoCtrlHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/RutaCombinacionHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/RutaCombinacionHibernateDAO.java index 218d11427..291b8a88f 100644 --- a/src/com/rjconsultores/ventaboletos/dao/hibernate/RutaCombinacionHibernateDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/RutaCombinacionHibernateDAO.java @@ -842,4 +842,30 @@ public class RutaCombinacionHibernateDAO extends GenericHibernateDAO 0l; } + + @Override + public boolean isRutaCombinacionVenda(Integer rutaId, Integer origenId, Integer destinoId) { + if(rutaId == null || origenId == null || destinoId == null) { + return false; + } + + StringBuilder sQuery = new StringBuilder(); + sQuery.append("select rc.rutacombinacion_id ") + .append("from ruta_combinacion rc ") + .append("join tramo t on t.tramo_id = rc.tramo_id ") + .append("where rc.activo = 1 ") + .append("and rc.indventa = 1 ") + .append("and t.activo = 1 ") + .append("and rc.ruta_id = :rutaId ") + .append("and t.origen_id = :origenId ") + .append("and t.destino_id = :destinoId "); + + Query qr = getSession().createSQLQuery(sQuery.toString()); + qr.setParameter("rutaId", rutaId); + qr.setParameter("origenId", origenId); + qr.setParameter("destinoId", destinoId); + + return !qr.list().isEmpty(); + } + } diff --git a/src/com/rjconsultores/ventaboletos/entidad/Conexion.java b/src/com/rjconsultores/ventaboletos/entidad/Conexion.java index 3e54bea87..135622be0 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/Conexion.java +++ b/src/com/rjconsultores/ventaboletos/entidad/Conexion.java @@ -59,7 +59,7 @@ public class Conexion implements Serializable { @Column(name = "RUTA_ID") private Integer rutaId; @Column(name = "CONEXIONRUTATRAMOCTRL_ID") - private Integer conexionRutaTramoId; + private Long conexionRutaTramoId; public Long getCorridaId() { return corridaId; @@ -194,11 +194,11 @@ public class Conexion implements Serializable { this.rutaId = rutaId; } - public Integer getConexionRutaTramoId() { + public Long getConexionRutaTramoId() { return conexionRutaTramoId; } - public void setConexionRutaTramoId(Integer conexionRutaTramoId) { + public void setConexionRutaTramoId(Long conexionRutaTramoId) { this.conexionRutaTramoId = conexionRutaTramoId; } diff --git a/src/com/rjconsultores/ventaboletos/entidad/ConexionCtrl.java b/src/com/rjconsultores/ventaboletos/entidad/ConexionCtrl.java index dd0ac244e..72e35a40b 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/ConexionCtrl.java +++ b/src/com/rjconsultores/ventaboletos/entidad/ConexionCtrl.java @@ -16,6 +16,7 @@ import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import javax.persistence.Transient; /** * @@ -41,18 +42,20 @@ public class ConexionCtrl implements Serializable { private Integer origenId; @Column(name = "DESTINO_ID") private Integer destinoId; - + + @Transient + private Integer grupos; + public ConexionCtrl() { } - - public ConexionCtrl(Integer origenId, Integer destinoId) { - super(); + public ConexionCtrl(Integer origenId, Integer destinoId, Integer grupos) { + this(); this.origenId = origenId; this.destinoId = destinoId; + this.grupos = grupos; } - public ConexionCtrl(Long conexionctrlId) { this.conexionctrlId = conexionctrlId; } @@ -128,4 +131,17 @@ public class ConexionCtrl implements Serializable { public void setDestinoId(Integer destinoId) { this.destinoId = destinoId; } + + public Integer getGrupos() { + return grupos; + } + + public void setGrupos(Integer grupos) { + this.grupos = grupos; + } + + public boolean isOrigemDestinoIgual(Integer origemConexaoCtrl, Integer destinoConexaoCtrl) { + return getOrigenId().equals(origemConexaoCtrl) && getDestinoId().equals(destinoConexaoCtrl); + } + } diff --git a/src/com/rjconsultores/ventaboletos/entidad/ConexionRutaConf.java b/src/com/rjconsultores/ventaboletos/entidad/ConexionRutaConf.java index 8d195c365..de998ff07 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/ConexionRutaConf.java +++ b/src/com/rjconsultores/ventaboletos/entidad/ConexionRutaConf.java @@ -2,25 +2,18 @@ package com.rjconsultores.ventaboletos.entidad; import java.io.Serializable; import java.util.Date; -import java.util.List; import javax.persistence.Basic; -import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; -import javax.persistence.OneToMany; import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; -import org.hibernate.annotations.LazyCollection; -import org.hibernate.annotations.LazyCollectionOption; -import org.hibernate.annotations.Where; - /** * * @author wallace @@ -48,16 +41,6 @@ public class ConexionRutaConf implements Serializable { private Integer tiempoMin; @Column(name = "TIEMPOMAX") private Integer tiempoMax; - @OneToMany(mappedBy = "conexionRutaConf", cascade = CascadeType.ALL) - @LazyCollection(LazyCollectionOption.FALSE) - @Where(clause = "ACTIVO=1") - private List conexionRutaCanalVendasList; - - @OneToMany(mappedBy = "conexionRutaConf", cascade = CascadeType.ALL) - @LazyCollection(LazyCollectionOption.FALSE) - @Where(clause = "ACTIVO=1") - private List conexionRutaPuntoVendaList; - public ConexionRutaConf() { super(); @@ -125,27 +108,11 @@ public class ConexionRutaConf implements Serializable { return "ConexionRutaConf [descricao=" + descricao + "]"; } - public List getConexionRutaCanalVendasList() { - return conexionRutaCanalVendasList; - } - - public void setConexionRutaCanalVendasList(List conexionRutaCanalVendasList) { - this.conexionRutaCanalVendasList = conexionRutaCanalVendasList; - } - - public List getConexionRutaPuntoVendaList() { - return conexionRutaPuntoVendaList; - } - - public void setConexionRutaPuntoVendaList(List conexionRutaPuntoVendaList) { - this.conexionRutaPuntoVendaList = conexionRutaPuntoVendaList; - } - @Override public int hashCode() { final int prime = 31; int result = 1; - result = prime * result + ((conexionRutaConfId == null) ? 0 : conexionRutaConfId.hashCode()); + result = prime * result + ((getConexionRutaConfId() == null) ? 0 : getConexionRutaConfId().hashCode()); return result; } @@ -155,16 +122,15 @@ public class ConexionRutaConf implements Serializable { return true; if (obj == null) return false; - if (getClass() != obj.getClass()) + if (!(obj instanceof ConexionRutaConf)) return false; ConexionRutaConf other = (ConexionRutaConf) obj; - if (conexionRutaConfId == null) { - if (other.conexionRutaConfId != null) + if (getConexionRutaConfId() == null) { + if (other.getConexionRutaConfId() != null) return false; - } else if (!conexionRutaConfId.equals(other.conexionRutaConfId)) + } else if (!getConexionRutaConfId().equals(other.getConexionRutaConfId())) return false; return true; } - } diff --git a/src/com/rjconsultores/ventaboletos/entidad/ConexionRutaCtrl.java b/src/com/rjconsultores/ventaboletos/entidad/ConexionRutaCtrl.java index a7aaab25e..d4edd106c 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/ConexionRutaCtrl.java +++ b/src/com/rjconsultores/ventaboletos/entidad/ConexionRutaCtrl.java @@ -1,12 +1,10 @@ package com.rjconsultores.ventaboletos.entidad; import java.io.Serializable; -import java.util.ArrayList; import java.util.Date; import java.util.List; import javax.persistence.Basic; -import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; @@ -15,16 +13,11 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; -import javax.persistence.OneToMany; import javax.persistence.SequenceGenerator; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; -import org.hibernate.annotations.LazyCollection; -import org.hibernate.annotations.LazyCollectionOption; -import org.hibernate.annotations.Where; - /** * * @author wallace @@ -38,7 +31,7 @@ public class ConexionRutaCtrl implements Serializable { @Basic(optional = false) @GeneratedValue(strategy = GenerationType.AUTO, generator = "CONEXION_RUTA_CTRL_SEQ") @Column(name = "CONEXIONRUTACTRL_ID") - private Integer conexionRutaId; + private Long conexionRutaId; @Column(name = "ACTIVO") private Boolean activo; @Column(name = "FECMODIF") @@ -53,13 +46,10 @@ public class ConexionRutaCtrl implements Serializable { @Column(name = "RUTA_DESTINOC_ID") private Integer rutaDestinoCId; - @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "CONEXIONRUTACONF_ID") private ConexionRutaConf conexionRutaConf; - - public ConexionRutaCtrl() { super(); } @@ -68,11 +58,11 @@ public class ConexionRutaCtrl implements Serializable { return activo; } - public Integer getConexionRutaId() { + public Long getConexionRutaId() { return conexionRutaId; } - public void setConexionRutaId(Integer conexionRutaId) { + public void setConexionRutaId(Long conexionRutaId) { this.conexionRutaId = conexionRutaId; } @@ -152,5 +142,30 @@ public class ConexionRutaCtrl implements Serializable { return false; return true; } - + + public static ConexionRutaCtrl getConexionRutaCtrl(List list, Integer... rutas) { + if(rutas != null && rutas.length > 1) { + for (ConexionRutaCtrl conexionRutaCtrl : list) { + boolean isMatched = conexionRutaCtrl.getRutaOrigenId() != null && conexionRutaCtrl.getRutaOrigenId().equals(rutas[0]); + if(!isMatched) { + continue; + } + + isMatched = conexionRutaCtrl.getRutaDestinoId() != null && conexionRutaCtrl.getRutaDestinoId().equals(rutas[1]); + if(!isMatched) { + continue; + } + + if(rutas.length > 2 && conexionRutaCtrl.getRutaDestinoCId() != null) { + isMatched = conexionRutaCtrl.getRutaDestinoCId().equals(rutas[2]); + } + + if(isMatched) { + return conexionRutaCtrl; + } + } + } + throw new RuntimeException("ConexionRutaCtrl não identificada"); + } + } diff --git a/src/com/rjconsultores/ventaboletos/entidad/ConexionRutaExcepcionPtoVta.java b/src/com/rjconsultores/ventaboletos/entidad/ConexionRutaExcepcionPtoVta.java index a2fd1e548..0ff4a2353 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/ConexionRutaExcepcionPtoVta.java +++ b/src/com/rjconsultores/ventaboletos/entidad/ConexionRutaExcepcionPtoVta.java @@ -105,7 +105,7 @@ public class ConexionRutaExcepcionPtoVta implements Serializable { @Override public int hashCode() { int hash = 0; - hash += (conexionRutaPtovtaId != null ? conexionRutaPtovtaId.hashCode() : 0); + hash += (getConexionRutaPtovtaId() != null ? getConexionRutaPtovtaId().hashCode() : 0); return hash; } @@ -115,7 +115,7 @@ public class ConexionRutaExcepcionPtoVta implements Serializable { return false; } ConexionRutaExcepcionPtoVta other = (ConexionRutaExcepcionPtoVta) object; - if ((this.conexionRutaPtovtaId == null && other.conexionRutaPtovtaId != null) || (this.conexionRutaPtovtaId != null && !this.conexionRutaPtovtaId.equals(other.conexionRutaPtovtaId))) { + if ((this.getConexionRutaPtovtaId() == null && other.getConexionRutaPtovtaId() != null) || (this.getConexionRutaPtovtaId() != null && !this.getConexionRutaPtovtaId().equals(other.conexionRutaPtovtaId))) { return false; } return true; diff --git a/src/com/rjconsultores/ventaboletos/entidad/ConexionRutaExcepcionTipoPtoVta.java b/src/com/rjconsultores/ventaboletos/entidad/ConexionRutaExcepcionTipoPtoVta.java index 9c57d05fa..230f7d498 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/ConexionRutaExcepcionTipoPtoVta.java +++ b/src/com/rjconsultores/ventaboletos/entidad/ConexionRutaExcepcionTipoPtoVta.java @@ -105,7 +105,7 @@ public class ConexionRutaExcepcionTipoPtoVta implements Serializable { @Override public int hashCode() { int hash = 0; - hash += (conexionRutatipoptovtaId != null ? conexionRutatipoptovtaId.hashCode() : 0); + hash += (getConexionRutatipoptovtaId() != null ? getConexionRutatipoptovtaId().hashCode() : 0); return hash; } @@ -115,7 +115,7 @@ public class ConexionRutaExcepcionTipoPtoVta implements Serializable { return false; } ConexionRutaExcepcionTipoPtoVta other = (ConexionRutaExcepcionTipoPtoVta) object; - if ((this.conexionRutatipoptovtaId == null && other.conexionRutatipoptovtaId != null) || (this.conexionRutatipoptovtaId != null && !this.conexionRutatipoptovtaId.equals(other.conexionRutatipoptovtaId))) { + if ((this.getConexionRutatipoptovtaId() == null && other.getConexionRutatipoptovtaId() != null) || (this.getConexionRutatipoptovtaId() != null && !this.conexionRutatipoptovtaId.equals(other.getConexionRutatipoptovtaId()))) { return false; } return true; diff --git a/src/com/rjconsultores/ventaboletos/entidad/ConexionRutaTramoCtrl.java b/src/com/rjconsultores/ventaboletos/entidad/ConexionRutaTramoCtrl.java index 4f46a659e..1bfc3e043 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/ConexionRutaTramoCtrl.java +++ b/src/com/rjconsultores/ventaboletos/entidad/ConexionRutaTramoCtrl.java @@ -32,7 +32,7 @@ public class ConexionRutaTramoCtrl implements Serializable { @Basic(optional = false) @GeneratedValue(strategy = GenerationType.AUTO, generator = "CONEXION_RUTA_TRAMO_CTRL_SEQ") @Column(name = "CONEXIONRUTATRAMOCTRL_ID") - private Integer conexionRutaTramoId; + private Long conexionRutaTramoId; @Column(name = "ACTIVO") private Boolean activo; @Column(name = "FECMODIF") @@ -40,39 +40,51 @@ public class ConexionRutaTramoCtrl implements Serializable { private Date fecmodif; @Column(name = "USUARIO_ID") private Integer usuarioId; - @Column(name = "ORIGEN_ID") - private Integer origenId; - @Column(name = "DESTINO_ID") - private Integer destinoId; + + @ManyToOne + @JoinColumn(name = "ORIGEN_ID") + private Parada origen; + + @ManyToOne + @JoinColumn(name = "DESTINO_ID") + private Parada destino; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "CONEXIONRUTACTRL_ID") private ConexionRutaCtrl conexionRutaCtrl; - @Transient - private Integer rutaId; + + @ManyToOne + @JoinColumn(name = "RUTA_ID") + private Ruta ruta; + @Transient private Short secuencia; @Transient private boolean valido; @Transient private Integer grupo; + + public ConexionRutaTramoCtrl() { + super(); + } + + public ConexionRutaTramoCtrl(Long conexionRutaTramoId) { + this(); + this.conexionRutaTramoId = conexionRutaTramoId; + } public Boolean getActivo() { return activo; } - public Integer getConexionRutaTramoId() { + public Long getConexionRutaTramoId() { return conexionRutaTramoId; } - public void setConexionRutaTramoId(Integer conexionRutaTramoId) { + public void setConexionRutaTramoId(Long conexionRutaTramoId) { this.conexionRutaTramoId = conexionRutaTramoId; } - public Integer getOrigenId() { - return origenId; - } - public void setActivo(Boolean activo) { this.activo = activo; } @@ -93,18 +105,6 @@ public class ConexionRutaTramoCtrl implements Serializable { this.usuarioId = usuarioId; } - public void setOrigenId(Integer origenId) { - this.origenId = origenId; - } - - public Integer getDestinoId() { - return destinoId; - } - - public void setDestinoId(Integer destinoId) { - this.destinoId = destinoId; - } - public ConexionRutaCtrl getConexionRutaCtrl() { return conexionRutaCtrl; } @@ -113,14 +113,6 @@ public class ConexionRutaTramoCtrl implements Serializable { this.conexionRutaCtrl = conexionRutaCtrl; } - public Integer getRutaId() { - return rutaId; - } - - public void setRutaId(Integer rutaId) { - this.rutaId = rutaId; - } - public Short getSecuencia() { return secuencia; } @@ -145,7 +137,7 @@ public class ConexionRutaTramoCtrl implements Serializable { this.grupo = grupo; } - public static Integer getConexionRutaTramoConexionId(List conexiones) { + public static Long getConexionRutaTramoConexionId(List conexiones) { if(conexiones != null && !conexiones.isEmpty()) { Conexion conexionRutaTramoCtrl = conexiones.get(0); return conexionRutaTramoCtrl.getConexionRutaTramoId(); @@ -168,15 +160,39 @@ public class ConexionRutaTramoCtrl implements Serializable { return true; if (obj == null) return false; - if (getClass() != obj.getClass()) + if (!(obj instanceof ConexionRutaTramoCtrl)) return false; ConexionRutaTramoCtrl other = (ConexionRutaTramoCtrl) obj; - if (conexionRutaTramoId == null) { - if (other.conexionRutaTramoId != null) + if (getConexionRutaTramoId() == null) { + if (other.getConexionRutaTramoId() != null) return false; - } else if (!conexionRutaTramoId.equals(other.conexionRutaTramoId)) + } else if (!getConexionRutaTramoId().equals(other.getConexionRutaTramoId())) return false; return true; } + public Parada getOrigen() { + return origen; + } + + public void setOrigen(Parada origen) { + this.origen = origen; + } + + public Parada getDestino() { + return destino; + } + + public void setDestino(Parada destino) { + this.destino = destino; + } + + public Ruta getRuta() { + return ruta; + } + + public void setRuta(Ruta ruta) { + this.ruta = ruta; + } + } diff --git a/src/com/rjconsultores/ventaboletos/entidad/TipoPuntoVenta.java b/src/com/rjconsultores/ventaboletos/entidad/TipoPuntoVenta.java index a02e72082..1e99162d8 100644 --- a/src/com/rjconsultores/ventaboletos/entidad/TipoPuntoVenta.java +++ b/src/com/rjconsultores/ventaboletos/entidad/TipoPuntoVenta.java @@ -130,7 +130,7 @@ public class TipoPuntoVenta implements Serializable { @Override public int hashCode() { int hash = 0; - hash += (tipoptovtaId != null ? tipoptovtaId.hashCode() : 0); + hash += (getTipoptovtaId() != null ? getTipoptovtaId().hashCode() : 0); return hash; } @@ -142,7 +142,7 @@ public class TipoPuntoVenta implements Serializable { return false; } TipoPuntoVenta other = (TipoPuntoVenta) object; - if ((this.tipoptovtaId == null && other.tipoptovtaId != null) || (this.tipoptovtaId != null && !this.tipoptovtaId.equals(other.tipoptovtaId))) { + if ((this.getTipoptovtaId() == null && other.getTipoptovtaId() != null) || (this.getTipoptovtaId() != null && !this.getTipoptovtaId().equals(other.getTipoptovtaId()))) { return false; } return true; diff --git a/src/com/rjconsultores/ventaboletos/service/ConexionRutaConfService.java b/src/com/rjconsultores/ventaboletos/service/ConexionRutaConfService.java index 931b47783..1edebb756 100644 --- a/src/com/rjconsultores/ventaboletos/service/ConexionRutaConfService.java +++ b/src/com/rjconsultores/ventaboletos/service/ConexionRutaConfService.java @@ -21,5 +21,7 @@ public interface ConexionRutaConfService { public List buscarPorDescricao(String descricao); public ConexionRutaConf obtenerID(Integer id); + + public void excluirConfiguracao(ConexionRutaConf conexion, boolean excluirConexionRutaConf); } diff --git a/src/com/rjconsultores/ventaboletos/service/ConexionRutaTramoCtrlService.java b/src/com/rjconsultores/ventaboletos/service/ConexionRutaTramoCtrlService.java index 4a6792e8a..66788c1e0 100644 --- a/src/com/rjconsultores/ventaboletos/service/ConexionRutaTramoCtrlService.java +++ b/src/com/rjconsultores/ventaboletos/service/ConexionRutaTramoCtrlService.java @@ -4,12 +4,12 @@ import java.util.List; import com.rjconsultores.ventaboletos.entidad.ConexionRutaCtrl; import com.rjconsultores.ventaboletos.entidad.ConexionRutaTramoCtrl; +import com.rjconsultores.ventaboletos.entidad.Parada; public interface ConexionRutaTramoCtrlService { public void gerarConexiones(); - public ConexionRutaTramoCtrl suscribir(ConexionRutaTramoCtrl conexion); public ConexionRutaTramoCtrl actualizacion(ConexionRutaTramoCtrl conexion); @@ -17,15 +17,18 @@ public interface ConexionRutaTramoCtrlService { public void borrar(ConexionRutaTramoCtrl conexion); public List buscarPorConexionRutaCtrl(ConexionRutaCtrl conexionRutaCtrl); - public void borrar(List lsConexion); public void suscribirTodos(List conexiones); - - public ConexionRutaTramoCtrl buscarPorId(Integer conexionRutaTramoId); - + public ConexionRutaTramoCtrl buscarPorId(Long conexionRutaTramoId); public boolean validarConexioneRutasExistentes(Integer rutaOrigenId, Integer rutaDestinoId, Integer paradaOrigenId, Integer paradaDestinoId, Integer origemTrechoId, Integer destinoTrechoId, Integer integer); + + public List buscarLocalidadesOrigem(ConexionRutaCtrl conexionRutaCtrl); + + public List buscarLocalidadesDestino(ConexionRutaCtrl conexionRutaCtrl); + + public List buscarLocalidadesDestinoC(ConexionRutaCtrl conexionRutaCtrl); } diff --git a/src/com/rjconsultores/ventaboletos/service/RutaCombinacionService.java b/src/com/rjconsultores/ventaboletos/service/RutaCombinacionService.java index fcf50cdad..c7c819439 100644 --- a/src/com/rjconsultores/ventaboletos/service/RutaCombinacionService.java +++ b/src/com/rjconsultores/ventaboletos/service/RutaCombinacionService.java @@ -70,4 +70,6 @@ public interface RutaCombinacionService extends GenericService conexionesDescuentos) { + for (ConexionDescuento conexionDescuento : conexionesDescuentos) { + conexionDescuento.setFecModif(Calendar.getInstance().getTime()); + } conexionDescuentoHDAO.suscribirTodos(conexionesDescuentos); } - - } diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ConexionRutaConfServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ConexionRutaConfServiceImpl.java index 8cd680ee8..cca29d7f7 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/ConexionRutaConfServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/ConexionRutaConfServiceImpl.java @@ -83,4 +83,10 @@ public class ConexionRutaConfServiceImpl implements ConexionRutaConfService { return conexionRutaConfDAO.obtenerID(id); } + @Override + @Transactional + public void excluirConfiguracao(ConexionRutaConf conexion, boolean excluirConexionRutaConf) { + conexionRutaConfDAO.excluirConfiguracao(conexion, UsuarioLogado.getUsuarioLogado().getUsuarioId(), excluirConexionRutaConf); + } + } diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ConexionRutaTramoCtrlServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ConexionRutaTramoCtrlServiceImpl.java index dcb45f35e..7263a1d8a 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/ConexionRutaTramoCtrlServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/ConexionRutaTramoCtrlServiceImpl.java @@ -1,5 +1,6 @@ package com.rjconsultores.ventaboletos.service.impl; +import java.util.ArrayList; import java.util.Calendar; import java.util.List; @@ -10,6 +11,7 @@ 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.Parada; import com.rjconsultores.ventaboletos.service.ConexionRutaTramoCtrlService; import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado; @@ -77,7 +79,7 @@ public class ConexionRutaTramoCtrlServiceImpl implements ConexionRutaTramoCtrlSe } @Override - public ConexionRutaTramoCtrl buscarPorId(Integer conexionRutaTramoId) { + public ConexionRutaTramoCtrl buscarPorId(Long conexionRutaTramoId) { return conexionRutaTramoCtrlDAO.obtenerID(conexionRutaTramoId); } @@ -85,4 +87,51 @@ public class ConexionRutaTramoCtrlServiceImpl implements ConexionRutaTramoCtrlSe public boolean validarConexioneRutasExistentes(Integer rutaOrigenId, Integer rutaDestinoId, Integer rutaDestinoCId, Integer paradaOrigenId, Integer paradaDestinoId, Integer origemTrechoId, Integer destinoTrechoId) { return conexionRutaTramoCtrlDAO.validarConexioneRutasExistentes(rutaOrigenId, rutaDestinoId, rutaDestinoCId, paradaOrigenId, paradaDestinoId, origemTrechoId, destinoTrechoId); } + + @Override + public List buscarLocalidadesOrigem(ConexionRutaCtrl conexionRutaCtrl) { + return carregarParadas(conexionRutaCtrl, 'A'); + } + + @Override + public List buscarLocalidadesDestino(ConexionRutaCtrl conexionRutaCtrl) { + return carregarParadas(conexionRutaCtrl, 'B'); + } + + @Override + public List buscarLocalidadesDestinoC(ConexionRutaCtrl conexionRutaCtrl) { + return carregarParadas(conexionRutaCtrl, 'C'); + } + + private List carregarParadas(ConexionRutaCtrl conexionRutaCtrl, char tipo) { + List paradas = new ArrayList(0); + List trechos = buscarPorConexionRutaCtrl(conexionRutaCtrl); + for (ConexionRutaTramoCtrl conexionRutaTramoCtrl : trechos) { + if(conexionRutaTramoCtrl.getRuta() != null) { + switch (tipo) { + case 'A': + if(conexionRutaTramoCtrl.getRuta().getRutaId().equals(conexionRutaCtrl.getRutaOrigenId()) && + !paradas.contains(conexionRutaTramoCtrl.getOrigen())) { + paradas.add(conexionRutaTramoCtrl.getOrigen()); + } + break; + case 'B': + if(conexionRutaTramoCtrl.getRuta().getRutaId().equals(conexionRutaCtrl.getRutaDestinoId()) && + !paradas.contains(conexionRutaTramoCtrl.getDestino())) { + paradas.add(conexionRutaTramoCtrl.getDestino()); + } + break; + case 'C': + if(conexionRutaCtrl.getRutaDestinoCId() != null && + conexionRutaTramoCtrl.getRuta().getRutaId().equals(conexionRutaCtrl.getRutaDestinoCId()) && + !paradas.contains(conexionRutaTramoCtrl.getDestino())) { + paradas.add(conexionRutaTramoCtrl.getDestino()); + } + break; + } + + } + } + return paradas; + } } diff --git a/src/com/rjconsultores/ventaboletos/service/impl/RutaCombinacionServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/RutaCombinacionServiceImpl.java index 6b8d05fab..6e69a282a 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/RutaCombinacionServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/RutaCombinacionServiceImpl.java @@ -440,4 +440,9 @@ public class RutaCombinacionServiceImpl implements RutaCombinacionService { public boolean existeTramo(Tramo tramo) { return rutaCombinacionDAO.existeTramo(tramo); } + + @Override + public boolean isRutaCombinacionVenda(Integer rutaId, Integer origenId, Integer destinoId) { + return rutaCombinacionDAO.isRutaCombinacionVenda(rutaId, origenId, destinoId); + } } diff --git a/src/com/rjconsultores/ventaboletos/vo/parada/ConexionCtrlVO.java b/src/com/rjconsultores/ventaboletos/vo/parada/ConexionCtrlVO.java new file mode 100644 index 000000000..70d5bc03b --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/parada/ConexionCtrlVO.java @@ -0,0 +1,87 @@ +package com.rjconsultores.ventaboletos.vo.parada; + +public class ConexionCtrlVO { + + private Integer origenId; + private Integer destinoId; + private Integer grupo; + private boolean valida; + + public ConexionCtrlVO(Integer origemConexaoCtrl, Integer destinoConexaoCtrl) { + this.grupo = 0; + this.origenId = origemConexaoCtrl; + this.destinoId = destinoConexaoCtrl; + } + + public Integer getOrigenId() { + return origenId; + } + + public void setOrigenId(Integer origenId) { + this.origenId = origenId; + } + + public Integer getDestinoId() { + return destinoId; + } + + public void setDestinoId(Integer destinoId) { + this.destinoId = destinoId; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((destinoId == null) ? 0 : destinoId.hashCode()); + result = prime * result + ((origenId == null) ? 0 : origenId.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (!(obj instanceof ConexionCtrlVO)) + return false; + ConexionCtrlVO other = (ConexionCtrlVO) obj; + if (getDestinoId() == null) { + if (other.getDestinoId() != null) + return false; + } else if (!getDestinoId().equals(other.getDestinoId())) + return false; + if (getOrigenId() == null) { + if (other.getOrigenId() != null) + return false; + } else if (!getOrigenId().equals(other.getOrigenId())) + return false; + return true; + } + + public void incrementarGrupo() { + grupo++; + } + + public void decrementarGrupo() { + grupo--; + } + + public Integer getGrupo() { + return grupo; + } + + public boolean isOrigemDestinoIgual(Integer origemConexaoCtrl, Integer destinoConexaoCtrl) { + return getOrigenId().equals(origemConexaoCtrl) && getDestinoId().equals(destinoConexaoCtrl); + } + + public boolean isValida() { + return valida; + } + + public void setValida(boolean valida) { + this.valida = valida; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/parada/ConexionRutaCtrlVO.java b/src/com/rjconsultores/ventaboletos/vo/parada/ConexionRutaCtrlVO.java new file mode 100644 index 000000000..9cffdaa5f --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/vo/parada/ConexionRutaCtrlVO.java @@ -0,0 +1,76 @@ +package com.rjconsultores.ventaboletos.vo.parada; + +public class ConexionRutaCtrlVO { + + private Integer rutaIdA; + private Integer rutaIdB; + private Integer rutaIdC; + + public ConexionRutaCtrlVO(Integer rutaIdA, Integer rutaIdB, Integer rutaIdC) { + this.rutaIdA = rutaIdA; + this.rutaIdB = rutaIdB; + this.rutaIdC = rutaIdC; + } + + public Integer getRutaIdA() { + return rutaIdA; + } + + public void setRutaIdA(Integer rutaIdA) { + this.rutaIdA = rutaIdA; + } + + public Integer getRutaIdB() { + return rutaIdB; + } + + public void setRutaIdB(Integer rutaIdB) { + this.rutaIdB = rutaIdB; + } + + public Integer getRutaIdC() { + return rutaIdC; + } + + public void setRutaIdC(Integer rutaIdC) { + this.rutaIdC = rutaIdC; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((getRutaIdA() == null) ? 0 : getRutaIdA().hashCode()); + result = prime * result + ((getRutaIdB() == null) ? 0 : getRutaIdB().hashCode()); + result = prime * result + ((getRutaIdC() == null) ? 0 : getRutaIdC().hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (!(obj instanceof ConexionRutaCtrlVO)) + return false; + ConexionRutaCtrlVO other = (ConexionRutaCtrlVO) obj; + if (getRutaIdA() == null) { + if (other.getRutaIdA() != null) + return false; + } else if (!getRutaIdA().equals(other.getRutaIdA())) + return false; + if (getRutaIdB() == null) { + if (other.getRutaIdB() != null) + return false; + } else if (!getRutaIdB().equals(other.getRutaIdB())) + return false; + if (getRutaIdC() == null) { + if (other.getRutaIdC() != null) + return false; + } else if (!getRutaIdC().equals(other.getRutaIdC())) + return false; + return true; + } + +} diff --git a/src/com/rjconsultores/ventaboletos/vo/parada/ParadaVOConexionRuta.java b/src/com/rjconsultores/ventaboletos/vo/parada/ParadaVOConexionRuta.java index 8325bcac6..d96ad243f 100644 --- a/src/com/rjconsultores/ventaboletos/vo/parada/ParadaVOConexionRuta.java +++ b/src/com/rjconsultores/ventaboletos/vo/parada/ParadaVOConexionRuta.java @@ -4,6 +4,7 @@ import com.rjconsultores.ventaboletos.entidad.Parada; public class ParadaVOConexionRuta { + private Long conexionRutaTramoId; private Parada paradaOrigem; private Parada paradaDestino; private Parada paradaOrigemTrecho; @@ -13,8 +14,13 @@ public class ParadaVOConexionRuta { private Short secuencia; private boolean valido; private Integer grupo; + + private ConexionCtrlVO conexionCtrl; + private ConexionRutaCtrlVO conexionRutaCtrl; - public ParadaVOConexionRuta(int grupo, Parada paradaOrigem, Parada paradaDestino, Integer rutaId, String numRuta, Short secuencia, boolean valido, Parada paradaOrigemTrecho, Parada paradaDestinoTrecho) { + public ParadaVOConexionRuta(int grupo, Parada paradaOrigem, Parada paradaDestino, Integer rutaId, String numRuta, Short secuencia, + boolean valido, Parada paradaOrigemTrecho, Parada paradaDestinoTrecho, ConexionCtrlVO conexionCtrl, + ConexionRutaCtrlVO conexionRutaCtrl) { super(); this.grupo = grupo; this.paradaOrigem = paradaOrigem; @@ -25,6 +31,8 @@ public class ParadaVOConexionRuta { this.valido = valido; this.paradaOrigemTrecho = paradaOrigemTrecho; this.paradaDestinoTrecho = paradaDestinoTrecho; + this.conexionCtrl = conexionCtrl; + this.conexionRutaCtrl = conexionRutaCtrl; } public Parada getParadaOrigem() { @@ -104,4 +112,65 @@ public class ParadaVOConexionRuta { return "ParadaVOConexionRuta [paradaOrigem=" + paradaOrigem + ", paradaDestino=" + paradaDestino + ", paradaOrigemTrecho=" + paradaOrigemTrecho + ", paradaDestinoTrecho=" + paradaDestinoTrecho + ", rutaId=" + rutaId + ", numRuta=" + numRuta + ", secuencia=" + secuencia + ", valido=" + valido + "]"; } + public ConexionCtrlVO getConexionCtrl() { + return conexionCtrl; + } + + public void setConexionCtrl(ConexionCtrlVO conexionCtrl) { + this.conexionCtrl = conexionCtrl; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((getParadaDestino() == null) ? 0 : getParadaDestino().hashCode()); + result = prime * result + ((getParadaOrigem() == null) ? 0 : getParadaOrigem().hashCode()); + result = prime * result + ((getRutaId() == null) ? 0 : getRutaId().hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (!(obj instanceof ParadaVOConexionRuta)) + return false; + ParadaVOConexionRuta other = (ParadaVOConexionRuta) obj; + if (getParadaDestino() == null) { + if (other.getParadaDestino() != null) + return false; + } else if (!getParadaDestino().equals(other.getParadaDestino())) + return false; + if (getParadaOrigem() == null) { + if (other.getParadaOrigem() != null) + return false; + } else if (!getParadaOrigem().equals(other.getParadaOrigem())) + return false; + if (getRutaId() == null) { + if (other.getRutaId() != null) + return false; + } else if (!getRutaId().equals(other.getRutaId())) + return false; + return true; + } + + public ConexionRutaCtrlVO getConexionRutaCtrl() { + return conexionRutaCtrl; + } + + public void setConexionRutaCtrl(ConexionRutaCtrlVO conexionRutaCtrl) { + this.conexionRutaCtrl = conexionRutaCtrl; + } + + public Long getConexionRutaTramoId() { + return conexionRutaTramoId; + } + + public void setConexionRutaTramoId(Long conexionRutaTramoId) { + this.conexionRutaTramoId = conexionRutaTramoId; + } + } \ No newline at end of file