fixes bug #8659
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@67559 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
2f6728196b
commit
f13487c69b
|
@ -0,0 +1,9 @@
|
||||||
|
package com.rjconsultores.ventaboletos.dao;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ConexionDescuento;
|
||||||
|
|
||||||
|
public interface ConexionDescuentoDAO extends GenericDAO<ConexionDescuento, Long> {
|
||||||
|
public List<ConexionDescuento> bucarPorConexion(Long conexionId);
|
||||||
|
}
|
|
@ -95,4 +95,6 @@ public interface CorridaDAO extends GenericDAO<Corrida, Corrida.Id> {
|
||||||
|
|
||||||
List<Corrida> buscarCorridaRelAproveitamento(Parada origem, Parada destino, Date feccorrida, Integer corridaId);
|
List<Corrida> buscarCorridaRelAproveitamento(Parada origem, Parada destino, Date feccorrida, Integer corridaId);
|
||||||
|
|
||||||
|
public Boolean existeCorrida(Long id);
|
||||||
|
|
||||||
}
|
}
|
|
@ -4,6 +4,7 @@
|
||||||
*/
|
*/
|
||||||
package com.rjconsultores.ventaboletos.dao;
|
package com.rjconsultores.ventaboletos.dao;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -22,6 +23,8 @@ public interface GenericDAO<T, ID> {
|
||||||
|
|
||||||
public void borrar(T entidad);
|
public void borrar(T entidad);
|
||||||
|
|
||||||
public Long count(String campo,Object o);
|
public Long count(String campo, Object o);
|
||||||
|
|
||||||
|
public void suscribirTodos(Collection<T> entidades);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
package com.rjconsultores.ventaboletos.dao.hibernate;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.hibernate.Criteria;
|
||||||
|
import org.hibernate.SessionFactory;
|
||||||
|
import org.hibernate.criterion.Restrictions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.dao.ConexionDescuentoDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ConexionDescuento;
|
||||||
|
|
||||||
|
@Repository("conexionDescuentoDAO")
|
||||||
|
public class ConexionDescuentoHibernateDAO extends GenericHibernateDAO<ConexionDescuento, Long>
|
||||||
|
implements ConexionDescuentoDAO {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public ConexionDescuentoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
|
||||||
|
setSessionFactory(factory);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public List<ConexionDescuento> bucarPorConexion(Long conexionId) {
|
||||||
|
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||||
|
c.add(Restrictions.eq("conexion.conexionId", conexionId));
|
||||||
|
c.add(Restrictions.eq("activo", true));
|
||||||
|
return c.list();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -717,7 +717,7 @@ public class CorridaHibernateDAO extends GenericHibernateDAO<Corrida, Corrida.Id
|
||||||
|
|
||||||
for (CorridaTramo tramo : tramos) {
|
for (CorridaTramo tramo : tramos) {
|
||||||
for (CorridaTramo tramoPadrao : tramosPadrao) {
|
for (CorridaTramo tramoPadrao : tramosPadrao) {
|
||||||
if(tramoPadrao.getNumsecuencia().equals(tramo.getNumsecuencia())){
|
if (tramoPadrao.getNumsecuencia().equals(tramo.getNumsecuencia())) {
|
||||||
tramo.setFechorsalida(mudarData(tramoPadrao.getFechorsalida(), tramo.getFechorsalida()));
|
tramo.setFechorsalida(mudarData(tramoPadrao.getFechorsalida(), tramo.getFechorsalida()));
|
||||||
tramo.setFechorsalidaH(mudarData(tramoPadrao.getFechorsalidaH(), tramo.getFechorsalidaH()));
|
tramo.setFechorsalidaH(mudarData(tramoPadrao.getFechorsalidaH(), tramo.getFechorsalidaH()));
|
||||||
tramo.setFechorSalidaOriginal(mudarData(tramoPadrao.getFechorSalidaOriginal(), tramo.getFechorSalidaOriginal()));
|
tramo.setFechorSalidaOriginal(mudarData(tramoPadrao.getFechorSalidaOriginal(), tramo.getFechorSalidaOriginal()));
|
||||||
|
@ -729,13 +729,12 @@ public class CorridaHibernateDAO extends GenericHibernateDAO<Corrida, Corrida.Id
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Date mudarData(Date dataPadrao,Date dataMudanca){
|
private Date mudarData(Date dataPadrao, Date dataMudanca) {
|
||||||
Calendar calPadrao = Calendar.getInstance();
|
Calendar calPadrao = Calendar.getInstance();
|
||||||
calPadrao.setTime(dataPadrao);
|
calPadrao.setTime(dataPadrao);
|
||||||
Calendar calMudanca = Calendar.getInstance();
|
Calendar calMudanca = Calendar.getInstance();
|
||||||
|
@ -754,7 +753,7 @@ public class CorridaHibernateDAO extends GenericHibernateDAO<Corrida, Corrida.Id
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Corrida> buscarCorridaRelAproveitamento( Parada origem, Parada destino,
|
public List<Corrida> buscarCorridaRelAproveitamento(Parada origem, Parada destino,
|
||||||
Date feccorrida, Integer corridaId) {
|
Date feccorrida, Integer corridaId) {
|
||||||
|
|
||||||
StringBuilder sql = new StringBuilder();
|
StringBuilder sql = new StringBuilder();
|
||||||
|
@ -776,14 +775,14 @@ public class CorridaHibernateDAO extends GenericHibernateDAO<Corrida, Corrida.Id
|
||||||
sql.append(" inner join ruta r on c.ruta_id = r.ruta_id ");
|
sql.append(" inner join ruta r on c.ruta_id = r.ruta_id ");
|
||||||
sql.append(" inner join clase_servicio cs on c.claseservicio_id = cs.claseservicio_id ");
|
sql.append(" inner join clase_servicio cs on c.claseservicio_id = cs.claseservicio_id ");
|
||||||
sql.append(" where c.activo <> 0 ");
|
sql.append(" where c.activo <> 0 ");
|
||||||
if(corridaId!=null){
|
if (corridaId != null) {
|
||||||
sql.append(" and c.corrida_id = :corridaId ");
|
sql.append(" and c.corrida_id = :corridaId ");
|
||||||
}
|
}
|
||||||
sql.append(feccorrida == null ? "" : " and c.feccorrida = :feccorrida ");
|
sql.append(feccorrida == null ? "" : " and c.feccorrida = :feccorrida ");
|
||||||
if(origem!=null){
|
if (origem != null) {
|
||||||
sql.append(origem == null ? "" : " and c.origen_id = :origen_id ");
|
sql.append(origem == null ? "" : " and c.origen_id = :origen_id ");
|
||||||
}
|
}
|
||||||
if(destino!=null){
|
if (destino != null) {
|
||||||
sql.append(destino == null ? "" : " and c.destino_id = :destino_id ");
|
sql.append(destino == null ? "" : " and c.destino_id = :destino_id ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -792,10 +791,10 @@ public class CorridaHibernateDAO extends GenericHibernateDAO<Corrida, Corrida.Id
|
||||||
query.setParameter("corridaId", corridaId);
|
query.setParameter("corridaId", corridaId);
|
||||||
}
|
}
|
||||||
query.setParameter("feccorrida", feccorrida);
|
query.setParameter("feccorrida", feccorrida);
|
||||||
if(origem!=null){
|
if (origem != null) {
|
||||||
query.setParameter("origen_id", origem.getParadaId());
|
query.setParameter("origen_id", origem.getParadaId());
|
||||||
}
|
}
|
||||||
if(destino!=null){
|
if (destino != null) {
|
||||||
query.setParameter("destino_id", destino.getParadaId());
|
query.setParameter("destino_id", destino.getParadaId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -806,31 +805,31 @@ public class CorridaHibernateDAO extends GenericHibernateDAO<Corrida, Corrida.Id
|
||||||
if (lsObject != null && !lsObject.isEmpty()) {
|
if (lsObject != null && !lsObject.isEmpty()) {
|
||||||
|
|
||||||
for (Object object : lsObject) {
|
for (Object object : lsObject) {
|
||||||
if(object!=null){
|
if (object != null) {
|
||||||
Object objectArray[] = (Object[]) object;
|
Object objectArray[] = (Object[]) object;
|
||||||
Id id = new Id();
|
Id id = new Id();
|
||||||
id.setCorridaId(((BigDecimal)objectArray[0]).intValue());
|
id.setCorridaId(((BigDecimal) objectArray[0]).intValue());
|
||||||
id.setFeccorrida((Timestamp)objectArray[1]);
|
id.setFeccorrida((Timestamp) objectArray[1]);
|
||||||
|
|
||||||
Parada o = new Parada();
|
Parada o = new Parada();
|
||||||
o.setParadaId(((BigDecimal)objectArray[3]).intValue());
|
o.setParadaId(((BigDecimal) objectArray[3]).intValue());
|
||||||
o.setDescparada((String)objectArray[4]);
|
o.setDescparada((String) objectArray[4]);
|
||||||
|
|
||||||
Parada d = new Parada();
|
Parada d = new Parada();
|
||||||
d.setParadaId(((BigDecimal)objectArray[5]).intValue());
|
d.setParadaId(((BigDecimal) objectArray[5]).intValue());
|
||||||
d.setDescparada((String)objectArray[6]);
|
d.setDescparada((String) objectArray[6]);
|
||||||
|
|
||||||
Ruta ruta = new Ruta();
|
Ruta ruta = new Ruta();
|
||||||
ruta.setRutaId(((BigDecimal)objectArray[7]).intValue());
|
ruta.setRutaId(((BigDecimal) objectArray[7]).intValue());
|
||||||
ruta.setDescruta((String)objectArray[8]);
|
ruta.setDescruta((String) objectArray[8]);
|
||||||
|
|
||||||
ClaseServicio claseServicio = new ClaseServicio();
|
ClaseServicio claseServicio = new ClaseServicio();
|
||||||
claseServicio.setClaseservicioId(((BigDecimal)objectArray[9]).intValue());
|
claseServicio.setClaseservicioId(((BigDecimal) objectArray[9]).intValue());
|
||||||
claseServicio.setDescclase((String)objectArray[10]);
|
claseServicio.setDescclase((String) objectArray[10]);
|
||||||
|
|
||||||
Corrida corrida = new Corrida();
|
Corrida corrida = new Corrida();
|
||||||
corrida.setId(id);
|
corrida.setId(id);
|
||||||
corrida.setFechorsalida((Timestamp)objectArray[2]);
|
corrida.setFechorsalida((Timestamp) objectArray[2]);
|
||||||
corrida.setOrigem(o);
|
corrida.setOrigem(o);
|
||||||
corrida.setDestino(d);
|
corrida.setDestino(d);
|
||||||
corrida.setRuta(ruta);
|
corrida.setRuta(ruta);
|
||||||
|
@ -842,4 +841,15 @@ public class CorridaHibernateDAO extends GenericHibernateDAO<Corrida, Corrida.Id
|
||||||
}
|
}
|
||||||
return lsCorridas;
|
return lsCorridas;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean existeCorrida(Long id) {
|
||||||
|
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||||
|
c.add(Restrictions.eq("id.corridaId", id.intValue()));
|
||||||
|
c.setMaxResults(1);
|
||||||
|
if (c.uniqueResult() != null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ package com.rjconsultores.ventaboletos.dao.hibernate;
|
||||||
import com.rjconsultores.ventaboletos.dao.GenericDAO;
|
import com.rjconsultores.ventaboletos.dao.GenericDAO;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.lang.reflect.ParameterizedType;
|
import java.lang.reflect.ParameterizedType;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.hibernate.Criteria;
|
import org.hibernate.Criteria;
|
||||||
import org.hibernate.HibernateException;
|
import org.hibernate.HibernateException;
|
||||||
|
@ -104,4 +105,8 @@ public class GenericHibernateDAO<T, ID extends Serializable> extends HibernateDa
|
||||||
return HibernateFix.count(c.list());
|
return HibernateFix.count(c.list());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void suscribirTodos(Collection<T> entidades) {
|
||||||
|
getHibernateTemplate().saveOrUpdateAll(entidades);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,9 @@
|
||||||
package com.rjconsultores.ventaboletos.entidad;
|
package com.rjconsultores.ventaboletos.entidad;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import javax.persistence.Basic;
|
import javax.persistence.Basic;
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
|
@ -13,10 +15,13 @@ import javax.persistence.Entity;
|
||||||
import javax.persistence.GeneratedValue;
|
import javax.persistence.GeneratedValue;
|
||||||
import javax.persistence.GenerationType;
|
import javax.persistence.GenerationType;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.OneToMany;
|
||||||
import javax.persistence.SequenceGenerator;
|
import javax.persistence.SequenceGenerator;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
import javax.persistence.Temporal;
|
import javax.persistence.Temporal;
|
||||||
import javax.persistence.TemporalType;
|
import javax.persistence.TemporalType;
|
||||||
|
import javax.persistence.Transient;
|
||||||
|
import javax.persistence.Version;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -51,6 +56,8 @@ public class Conexion implements Serializable {
|
||||||
private Long conexionctrlId;
|
private Long conexionctrlId;
|
||||||
@Column(name = "CORRIDA_ID")
|
@Column(name = "CORRIDA_ID")
|
||||||
private Long corridaId;
|
private Long corridaId;
|
||||||
|
@Transient
|
||||||
|
private List<ConexionDescuento> conexionesDescuentos;
|
||||||
|
|
||||||
public Long getCorridaId() {
|
public Long getCorridaId() {
|
||||||
return corridaId;
|
return corridaId;
|
||||||
|
@ -61,10 +68,12 @@ public class Conexion implements Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Conexion() {
|
public Conexion() {
|
||||||
|
this(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Conexion(Long conexionId) {
|
public Conexion(Long conexionId) {
|
||||||
this.conexionId = conexionId;
|
this.conexionId = conexionId;
|
||||||
|
conexionesDescuentos = new ArrayList<ConexionDescuento>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getConexionId() {
|
public Long getConexionId() {
|
||||||
|
@ -166,4 +175,13 @@ public class Conexion implements Serializable {
|
||||||
public void setDestinoId(Integer destinoId) {
|
public void setDestinoId(Integer destinoId) {
|
||||||
this.destinoId = destinoId;
|
this.destinoId = destinoId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<ConexionDescuento> getConexionesDescuentos() {
|
||||||
|
return conexionesDescuentos;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setConexionesDescuentos(List<ConexionDescuento> conexionesDescuentos) {
|
||||||
|
this.conexionesDescuentos = conexionesDescuentos;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,16 +41,6 @@ public class ConexionCtrl implements Serializable {
|
||||||
private Integer origenId;
|
private Integer origenId;
|
||||||
@Column(name = "DESTINO_ID")
|
@Column(name = "DESTINO_ID")
|
||||||
private Integer destinoId;
|
private Integer destinoId;
|
||||||
@Column(name = "INDFIXA")
|
|
||||||
private Integer indfixa;
|
|
||||||
|
|
||||||
public Integer getIndfixa() {
|
|
||||||
return indfixa;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setIndfixa(Integer indfixa) {
|
|
||||||
this.indfixa = indfixa;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ConexionCtrl() {
|
public ConexionCtrl() {
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,124 @@
|
||||||
|
package com.rjconsultores.ventaboletos.entidad;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.GeneratedValue;
|
||||||
|
import javax.persistence.GenerationType;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.JoinColumn;
|
||||||
|
import javax.persistence.ManyToOne;
|
||||||
|
import javax.persistence.SequenceGenerator;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@SequenceGenerator(name = "CONEXION_DESCUENTO_SEQ", sequenceName = "CONEXION_DESCUENTO_SEQ", allocationSize = 1)
|
||||||
|
@Table(name = "CONEXION_DESCUENTO")
|
||||||
|
public class ConexionDescuento {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.AUTO, generator = "CONEXION_DESCUENTO_SEQ")
|
||||||
|
@Column(name = "CONEXIONDESCUENTO_ID")
|
||||||
|
private Long idConexionDescuento;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
private Boolean activo;
|
||||||
|
|
||||||
|
@ManyToOne
|
||||||
|
@JoinColumn(name = "CONEXION_ID")
|
||||||
|
private Conexion conexion;
|
||||||
|
|
||||||
|
@ManyToOne(targetEntity = ClaseServicio.class)
|
||||||
|
@JoinColumn(name = "CLASSESERVICIO_ID")
|
||||||
|
private ClaseServicio claseServicio;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
private Short secuencia;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
private Integer grupo;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
private BigDecimal descuento;
|
||||||
|
|
||||||
|
@Column
|
||||||
|
private Date fecModif;
|
||||||
|
|
||||||
|
public Long getIdConexionDescuento() {
|
||||||
|
return idConexionDescuento;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIdConexionDescuento(Long idConexionDescuento) {
|
||||||
|
this.idConexionDescuento = idConexionDescuento;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getActivo() {
|
||||||
|
return activo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setActivo(Boolean activo) {
|
||||||
|
this.activo = activo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Conexion getConexion() {
|
||||||
|
return conexion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setConexion(Conexion conexion) {
|
||||||
|
this.conexion = conexion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ClaseServicio getClaseServicio() {
|
||||||
|
return claseServicio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setClaseServicio(ClaseServicio claseServicio) {
|
||||||
|
this.claseServicio = claseServicio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Short getSecuencia() {
|
||||||
|
return secuencia;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSecuencia(Short secuencia) {
|
||||||
|
this.secuencia = secuencia;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getGrupo() {
|
||||||
|
return grupo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGrupo(Integer grupo) {
|
||||||
|
this.grupo = grupo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getDescuento() {
|
||||||
|
return descuento;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescuento(BigDecimal descuento) {
|
||||||
|
this.descuento = descuento;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getFecModif() {
|
||||||
|
return fecModif;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFecModif(Date fecModif) {
|
||||||
|
this.fecModif = fecModif;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (!(obj instanceof ConexionDescuento)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
ConexionDescuento other = (ConexionDescuento) obj;
|
||||||
|
if(this.getClaseServicio()==null &&other.getClaseServicio()==null){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return this.getClaseServicio().equals(other.getClaseServicio());
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,5 +1,6 @@
|
||||||
package com.rjconsultores.ventaboletos.service;
|
package com.rjconsultores.ventaboletos.service;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.rjconsultores.ventaboletos.entidad.ConexionConf;
|
import com.rjconsultores.ventaboletos.entidad.ConexionConf;
|
||||||
|
@ -10,4 +11,6 @@ public interface ConexionConfService extends GenericService<ConexionConf, Long>
|
||||||
public ConexionConf buscar(Long conexionCtrlId, Integer numgrupo);
|
public ConexionConf buscar(Long conexionCtrlId, Integer numgrupo);
|
||||||
|
|
||||||
public List<ConexionConf> buscarPorConexionCtrl(ConexionCtrl entidad);
|
public List<ConexionConf> buscarPorConexionCtrl(ConexionCtrl entidad);
|
||||||
|
|
||||||
|
public void suscribirTodos(Collection<ConexionConf> conexionesConf);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.rjconsultores.ventaboletos.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Conexion;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ConexionDescuento;
|
||||||
|
|
||||||
|
public interface ConexionDescuentoService {
|
||||||
|
public List<ConexionDescuento> buscarPorConexion(Conexion conexion);
|
||||||
|
|
||||||
|
public ConexionDescuento suscribir(ConexionDescuento conexionDescuento);
|
||||||
|
|
||||||
|
public void borrar(ConexionDescuento conexionDescuento);
|
||||||
|
|
||||||
|
public void suscribirTodos(List<ConexionDescuento> conexionesDescuentos);
|
||||||
|
}
|
|
@ -27,4 +27,6 @@ public interface ConexionService {
|
||||||
|
|
||||||
public void borrar(List<Conexion> lsConexion);
|
public void borrar(List<Conexion> lsConexion);
|
||||||
|
|
||||||
|
public void suscribirTodos(List<Conexion> conexiones);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,4 +77,6 @@ public interface CorridaService extends GenericService<Corrida, Corrida.Id> {
|
||||||
|
|
||||||
public Corrida buscaCorrridaFutura(Ruta ruta, Date fecInicio);
|
public Corrida buscaCorrridaFutura(Ruta ruta, Date fecInicio);
|
||||||
|
|
||||||
|
public Boolean existeCorrida(Long id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,4 +72,6 @@ public interface TramoService {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public String gerarDescripcionTramo(Parada origen, Parada destino, Via via);
|
public String gerarDescripcionTramo(Parada origen, Parada destino, Via via);
|
||||||
|
|
||||||
|
public Boolean existe(Parada origem, Parada destino);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
|
|
||||||
package com.rjconsultores.ventaboletos.service.impl;
|
package com.rjconsultores.ventaboletos.service.impl;
|
||||||
|
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -62,4 +64,10 @@ public class ConexionConfServiceImpl implements ConexionConfService {
|
||||||
public List<ConexionConf> buscarPorConexionCtrl(ConexionCtrl entidad) {
|
public List<ConexionConf> buscarPorConexionCtrl(ConexionCtrl entidad) {
|
||||||
return conexionConfDAO.buscarPorConexionCtrl(entidad);
|
return conexionConfDAO.buscarPorConexionCtrl(entidad);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public void suscribirTodos(Collection<ConexionConf> conexionesConf) {
|
||||||
|
conexionConfDAO.suscribirTodos(conexionesConf);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,52 @@
|
||||||
|
package com.rjconsultores.ventaboletos.service.impl;
|
||||||
|
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.dao.hibernate.ConexionDescuentoHibernateDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Conexion;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ConexionDescuento;
|
||||||
|
import com.rjconsultores.ventaboletos.service.ConexionDescuentoService;
|
||||||
|
|
||||||
|
@Service("conexionDescuentoService")
|
||||||
|
public class ConexionDescuentoServiceImpl implements ConexionDescuentoService {
|
||||||
|
@Autowired
|
||||||
|
ConexionDescuentoHibernateDAO conexionDescuentoHDAO;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ConexionDescuento> buscarPorConexion(Conexion conexion) {
|
||||||
|
return conexionDescuentoHDAO.bucarPorConexion(conexion.getConexionId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public ConexionDescuento suscribir(ConexionDescuento conexionDescuento) {
|
||||||
|
conexionDescuento.setActivo(true);
|
||||||
|
conexionDescuento.setFecModif(Calendar.getInstance().getTime());
|
||||||
|
if (conexionDescuento.getIdConexionDescuento() == null) {
|
||||||
|
return conexionDescuentoHDAO.suscribir(conexionDescuento);
|
||||||
|
}
|
||||||
|
return conexionDescuentoHDAO.actualizacion(conexionDescuento);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public void borrar(ConexionDescuento conexionDescuento) {
|
||||||
|
conexionDescuento.setActivo(false);
|
||||||
|
this.suscribir(conexionDescuento);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public void suscribirTodos(List<ConexionDescuento> conexionesDescuentos) {
|
||||||
|
conexionDescuentoHDAO.suscribirTodos(conexionesDescuentos);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -78,4 +78,10 @@ public class ConexionServiceImpl implements ConexionService {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public void suscribirTodos(List<Conexion> conexiones) {
|
||||||
|
conexionDAO.suscribirTodos(conexiones);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -191,6 +191,10 @@ public class CorridaServiceImpl implements CorridaService {
|
||||||
return corridaDAO.buscarFiltro(ori, des, hora, cs);
|
return corridaDAO.buscarFiltro(ori, des, hora, cs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Boolean existeCorrida(Long id){
|
||||||
|
return corridaDAO.existeCorrida(id);
|
||||||
|
}
|
||||||
|
|
||||||
private Boolean geraDiaSemana(Integer diaSemana, EsquemaCorrida esquemaCorrida) {
|
private Boolean geraDiaSemana(Integer diaSemana, EsquemaCorrida esquemaCorrida) {
|
||||||
Boolean retorno = Boolean.FALSE;
|
Boolean retorno = Boolean.FALSE;
|
||||||
switch (diaSemana) {
|
switch (diaSemana) {
|
||||||
|
|
|
@ -271,4 +271,12 @@ public class TramoServiceImpl implements TramoService {
|
||||||
return tramoDAO.actualizacion(tramo);
|
return tramoDAO.actualizacion(tramo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean existe(Parada origem, Parada destino) {
|
||||||
|
if(tramoDAO.obtenerPorOrigemDestino(origem, destino).getTramoId()!=null){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue