fixes bug#24409
dev:wallace qua:24409 git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@112530 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
d303370e89
commit
50ba53e02c
|
@ -0,0 +1,15 @@
|
|||
package com.rjconsultores.ventaboletos.dao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.ConfTotemVentaRapida;
|
||||
import com.rjconsultores.ventaboletos.entidad.Parada;
|
||||
|
||||
public interface ConfTotemVentaRapidaDAO extends GenericDAO<ConfTotemVentaRapida, Integer> {
|
||||
|
||||
ConfTotemVentaRapida buscarOrigemDestino(Parada origem, Parada destino);
|
||||
|
||||
List<ConfTotemVentaRapida> buscarOrigem(Parada origem);
|
||||
|
||||
|
||||
}
|
|
@ -11,6 +11,7 @@ import com.rjconsultores.ventaboletos.entidad.Parada;
|
|||
import com.rjconsultores.ventaboletos.entidad.RegionMetropolitana;
|
||||
import com.rjconsultores.ventaboletos.entidad.Ruta;
|
||||
import com.rjconsultores.ventaboletos.entidad.TipoParada;
|
||||
import com.rjconsultores.ventaboletos.vo.parada.ParadaVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -60,4 +61,6 @@ public interface ParadaDAO {
|
|||
|
||||
public List<Parada> buscarPorAgrupamentoParadaId(AgrupamentoParada agrupamentoParada);
|
||||
|
||||
public List<Parada> buscarDestinosPorOrigem(Integer origemId);
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
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.ConfTotemVentaRapidaDAO;
|
||||
import com.rjconsultores.ventaboletos.entidad.ConfTotemVentaRapida;
|
||||
import com.rjconsultores.ventaboletos.entidad.Parada;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Wallace
|
||||
*/
|
||||
@Repository("ConfTotemVentaRapidaDAO")
|
||||
public class ConfTotemVentaRapidaHibernateDAO extends GenericHibernateDAO<ConfTotemVentaRapida, Integer> implements ConfTotemVentaRapidaDAO {
|
||||
|
||||
@Autowired
|
||||
public ConfTotemVentaRapidaHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
|
||||
setSessionFactory(factory);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfTotemVentaRapida buscarOrigemDestino(Parada origem, Parada destino) {
|
||||
|
||||
Criteria c = this.makeCriteria();
|
||||
c.add(Restrictions.eq("origen", origem));
|
||||
c.add(Restrictions.eq("destino", destino));
|
||||
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
||||
|
||||
return (ConfTotemVentaRapida) c.uniqueResult();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ConfTotemVentaRapida> buscarOrigem(Parada origem) {
|
||||
|
||||
Criteria c = this.makeCriteria();
|
||||
c.add(Restrictions.eq("origen", origem));
|
||||
c.add(Restrictions.eq("activo", Boolean.TRUE));
|
||||
|
||||
return c.list();
|
||||
}
|
||||
}
|
|
@ -7,11 +7,15 @@ package com.rjconsultores.ventaboletos.dao.hibernate;
|
|||
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.Order;
|
||||
import org.hibernate.criterion.Projections;
|
||||
import org.hibernate.criterion.Restrictions;
|
||||
import org.hibernate.transform.AliasToBeanResultTransformer;
|
||||
import org.hibernate.type.IntegerType;
|
||||
import org.hibernate.type.StringType;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
@ -24,6 +28,7 @@ import com.rjconsultores.ventaboletos.entidad.Parada;
|
|||
import com.rjconsultores.ventaboletos.entidad.RegionMetropolitana;
|
||||
import com.rjconsultores.ventaboletos.entidad.Ruta;
|
||||
import com.rjconsultores.ventaboletos.entidad.TipoParada;
|
||||
import com.rjconsultores.ventaboletos.vo.parada.ParadaVO;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -139,6 +144,36 @@ public class ParadaHibernateDAO extends GenericHibernateDAO<Parada, Integer> imp
|
|||
|
||||
return getSession().createQuery(sql).setEntity("origem", origem).list();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<Parada> buscarDestinosPorOrigem(Integer origenId){
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.append("select distinct p.PARADA_ID as paradaId, p.CVEPARADA as cveparada, p.DESCPARADA as descparada from RUTA_COMBINACION rc ")
|
||||
.append("inner join ruta r on rc.RUTA_ID=r.RUTA_ID ")
|
||||
.append("inner join ESQUEMA_CORRIDA ec on r.RUTA_ID=ec.RUTA_ID ")
|
||||
.append("inner join corrida c on ec.NUMCORRIDA=c.CORRIDA_ID ")
|
||||
.append("inner join parada p on p.parada_id=c.DESTINO_ID ")
|
||||
.append("where rc.ACTIVO = 1 and r.activo=1 and ec.activo=1 and c.activo=1 and p.activo = 1 and c.ORIGEN_ID=:origenId");
|
||||
|
||||
Query qry = getSession().createSQLQuery(sb.toString())
|
||||
.addScalar("paradaId", IntegerType.INSTANCE)
|
||||
.addScalar("cveparada", StringType.INSTANCE)
|
||||
.addScalar("descparada", StringType.INSTANCE)
|
||||
.setResultTransformer(new AliasToBeanResultTransformer(Parada.class));
|
||||
|
||||
qry.setInteger("origenId", origenId);
|
||||
|
||||
List<Parada> list = qry.list();
|
||||
|
||||
if (list.size() > 0) {
|
||||
return list;
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
public List<Parada> buscaParadaRegionMetropolitana(RegionMetropolitana regionMetropolitana) {
|
||||
Criteria c = getSession().createCriteria(getPersistentClass());
|
||||
|
|
|
@ -51,29 +51,6 @@ public class ConfTotem implements Serializable {
|
|||
public ConfTotem() {
|
||||
super();
|
||||
}
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((confTotemId == null) ? 0 : confTotemId.hashCode());
|
||||
return result;
|
||||
}
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
ConfTotem other = (ConfTotem) obj;
|
||||
if (confTotemId == null) {
|
||||
if (other.confTotemId != null)
|
||||
return false;
|
||||
} else if (!confTotemId.equals(other.confTotemId))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public String getValor() {
|
||||
return valor;
|
||||
|
@ -107,4 +84,28 @@ public class ConfTotem implements Serializable {
|
|||
this.chave = chave;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((confTotemId == null) ? 0 : confTotemId.hashCode());
|
||||
return result;
|
||||
}
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
ConfTotem other = (ConfTotem) obj;
|
||||
if (confTotemId == null) {
|
||||
if (other.confTotemId != null)
|
||||
return false;
|
||||
} else if (!confTotemId.equals(other.confTotemId))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,139 @@
|
|||
package com.rjconsultores.ventaboletos.entidad;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import javax.persistence.Basic;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.SequenceGenerator;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Temporal;
|
||||
import javax.persistence.TemporalType;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author wallace
|
||||
*/
|
||||
@Entity
|
||||
@SequenceGenerator(name = "CONFTOTEM_VENTARAPIDA_SEQ", sequenceName = "CONFTOTEM_VENTARAPIDA_SEQ", allocationSize = 1)
|
||||
@Table(name = "CONF_TOTEM_VENTARAPIDA")
|
||||
public class ConfTotemVentaRapida implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Id
|
||||
@Basic(optional = false)
|
||||
@GeneratedValue(strategy = GenerationType.AUTO, generator = "CONFTOTEM_VENTARAPIDA_SEQ")
|
||||
@Column(name = "CONFTOTEMVENTARAPIDA_ID")
|
||||
private Integer confTotemVentaRapidaId;
|
||||
@Column(name = "ACTIVO")
|
||||
private Boolean activo;
|
||||
@Column(name = "FECMODIF")
|
||||
@Temporal(TemporalType.TIMESTAMP)
|
||||
private Date fecmodif;
|
||||
@Column(name = "USUARIO_ID")
|
||||
private Integer usuarioId;
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "ORIGEN_ID")
|
||||
private Parada origen;
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "DESTINO_ID")
|
||||
private Parada destino;
|
||||
|
||||
public ConfTotemVentaRapida() {
|
||||
super();
|
||||
}
|
||||
|
||||
public ConfTotemVentaRapida(Parada origem, Parada destino) {
|
||||
this.origen = origem;
|
||||
this.destino = destino;
|
||||
}
|
||||
|
||||
public Integer getConfTotemVentaRapidaOri() {
|
||||
return confTotemVentaRapidaId;
|
||||
}
|
||||
|
||||
public void setConfTotemVentaRapidaId(Integer confTotemVentaRapidaId) {
|
||||
this.confTotemVentaRapidaId = confTotemVentaRapidaId;
|
||||
}
|
||||
|
||||
public Boolean getActivo() {
|
||||
return activo;
|
||||
}
|
||||
|
||||
public void setActivo(Boolean activo) {
|
||||
this.activo = activo;
|
||||
}
|
||||
|
||||
public Date getFecmodif() {
|
||||
return fecmodif;
|
||||
}
|
||||
|
||||
public void setFecmodif(Date fecmodif) {
|
||||
this.fecmodif = fecmodif;
|
||||
}
|
||||
|
||||
public Integer getUsuarioId() {
|
||||
return usuarioId;
|
||||
}
|
||||
|
||||
public void setUsuarioId(Integer usuarioId) {
|
||||
this.usuarioId = usuarioId;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((destino == null) ? 0 : destino.hashCode());
|
||||
result = prime * result + ((origen == null) ? 0 : origen.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
ConfTotemVentaRapida other = (ConfTotemVentaRapida) obj;
|
||||
if (destino == null) {
|
||||
if (other.destino != null)
|
||||
return false;
|
||||
} else if (!destino.equals(other.destino))
|
||||
return false;
|
||||
if (origen == null) {
|
||||
if (other.origen != null)
|
||||
return false;
|
||||
} else if (!origen.equals(other.origen))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package com.rjconsultores.ventaboletos.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.ConfTotemVentaRapida;
|
||||
import com.rjconsultores.ventaboletos.entidad.Parada;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author wallace
|
||||
*/
|
||||
public interface ConfTotemVentaRapidaService extends GenericService<ConfTotemVentaRapida, Integer>{
|
||||
|
||||
ConfTotemVentaRapida buscarOrigemDestino(Parada origem, Parada destino);
|
||||
|
||||
List<ConfTotemVentaRapida> buscarOrigem(Parada origen);
|
||||
|
||||
void apagarPorOrigem(Parada selectedObject);
|
||||
|
||||
|
||||
}
|
|
@ -15,6 +15,7 @@ import com.rjconsultores.ventaboletos.entidad.Ruta;
|
|||
import com.rjconsultores.ventaboletos.entidad.TipoParada;
|
||||
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
||||
import com.rjconsultores.ventaboletos.utilerias.RegistroConDependenciaException;
|
||||
import com.rjconsultores.ventaboletos.vo.parada.ParadaVO;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -46,4 +47,7 @@ public interface ParadaService {
|
|||
public List<Parada> buscaParadaRegionMetropolitana(RegionMetropolitana regionMetropolitana);
|
||||
|
||||
public List<Parada> buscarPorAgrupamentoParadaId(AgrupamentoParada agrupamentoParada);
|
||||
|
||||
public List<Parada> buscarDestinosPorOrigem(Integer origemId);
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,98 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package com.rjconsultores.ventaboletos.service.impl;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.rjconsultores.ventaboletos.dao.ConfTotemVentaRapidaDAO;
|
||||
import com.rjconsultores.ventaboletos.entidad.ConfTotemVentaRapida;
|
||||
import com.rjconsultores.ventaboletos.entidad.Parada;
|
||||
import com.rjconsultores.ventaboletos.service.ConfTotemVentaRapidaService;
|
||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author wallace
|
||||
*/
|
||||
@Service("confTotemVentaRapidaService")
|
||||
public class ConfTotemVentaRapidaServiceImpl implements ConfTotemVentaRapidaService {
|
||||
|
||||
@Autowired
|
||||
private ConfTotemVentaRapidaDAO confTotemVentaRapidaDAO;
|
||||
|
||||
@Override
|
||||
public List<ConfTotemVentaRapida> obtenerTodos() {
|
||||
return confTotemVentaRapidaDAO.obtenerTodos();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfTotemVentaRapida obtenerID(Integer id) {
|
||||
return confTotemVentaRapidaDAO.obtenerID(id);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public ConfTotemVentaRapida suscribir(ConfTotemVentaRapida entidad) {
|
||||
|
||||
entidad.setActivo(Boolean.TRUE);
|
||||
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||
|
||||
return confTotemVentaRapidaDAO.suscribir(entidad);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public ConfTotemVentaRapida actualizacion(ConfTotemVentaRapida entidad) {
|
||||
|
||||
|
||||
entidad.setActivo(Boolean.TRUE);
|
||||
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||
return confTotemVentaRapidaDAO.actualizacion(entidad);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public void borrar(ConfTotemVentaRapida entidad) {
|
||||
|
||||
entidad.setActivo(Boolean.FALSE);
|
||||
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||
|
||||
confTotemVentaRapidaDAO.actualizacion(entidad);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfTotemVentaRapida buscarOrigemDestino(Parada origem, Parada destino) {
|
||||
return confTotemVentaRapidaDAO.buscarOrigemDestino(origem, destino);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ConfTotemVentaRapida> buscarOrigem(Parada origem) {
|
||||
return confTotemVentaRapidaDAO.buscarOrigem(origem);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void apagarPorOrigem(Parada paradaOrigem) {
|
||||
|
||||
for (ConfTotemVentaRapida confTotemVentaRapida : confTotemVentaRapidaDAO.buscarOrigem(paradaOrigem)) {
|
||||
confTotemVentaRapida.setActivo(Boolean.FALSE);
|
||||
confTotemVentaRapida.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||
confTotemVentaRapida.setFecmodif(Calendar.getInstance().getTime());
|
||||
confTotemVentaRapidaDAO.actualizacion(confTotemVentaRapida);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -26,6 +26,7 @@ import com.rjconsultores.ventaboletos.exception.BusinessException;
|
|||
import com.rjconsultores.ventaboletos.service.ParadaService;
|
||||
import com.rjconsultores.ventaboletos.utilerias.RegistroConDependenciaException;
|
||||
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||
import com.rjconsultores.ventaboletos.vo.parada.ParadaVO;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -179,4 +180,9 @@ public class ParadaServiceImpl implements ParadaService {
|
|||
public List<Parada> buscarPorAgrupamentoParadaId(AgrupamentoParada agrupamentoParada){
|
||||
return paradaDAO.buscarPorAgrupamentoParadaId(agrupamentoParada);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Parada> buscarDestinosPorOrigem(Integer origemId) {
|
||||
return paradaDAO.buscarDestinosPorOrigem(origemId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,67 @@
|
|||
package com.rjconsultores.ventaboletos.vo.conftotem;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.Parada;
|
||||
|
||||
public class ConfTotemVentaRapidaVO {
|
||||
|
||||
private Parada origem;
|
||||
private Parada destino;
|
||||
|
||||
public Parada getOrigem() {
|
||||
return origem;
|
||||
}
|
||||
|
||||
public void setOrigem(Parada origem) {
|
||||
this.origem = origem;
|
||||
}
|
||||
|
||||
public Parada getDestino() {
|
||||
return destino;
|
||||
}
|
||||
|
||||
public void setDestino(Parada destino) {
|
||||
this.destino = destino;
|
||||
}
|
||||
public ConfTotemVentaRapidaVO() {
|
||||
super();
|
||||
}
|
||||
|
||||
public ConfTotemVentaRapidaVO(Parada origem ,Parada destino) {
|
||||
super();
|
||||
this.origem = origem;
|
||||
this.destino = destino;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((destino == null) ? 0 : destino.hashCode());
|
||||
result = prime * result + ((origem == null) ? 0 : origem.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
ConfTotemVentaRapidaVO other = (ConfTotemVentaRapidaVO) obj;
|
||||
if (destino == null) {
|
||||
if (other.destino != null)
|
||||
return false;
|
||||
} else if (!destino.equals(other.destino))
|
||||
return false;
|
||||
if (origem == null) {
|
||||
if (other.origem != null)
|
||||
return false;
|
||||
} else if (!origem.equals(other.origem))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue