daniel.zauli 2015-10-15 15:14:12 +00:00
parent 8adca616ea
commit d84e1547f9
6 changed files with 494 additions and 0 deletions

View File

@ -0,0 +1,9 @@
package com.rjconsultores.ventaboletos.dao;
import java.util.List;
import com.rjconsultores.ventaboletos.entidad.ExcepcionPeaje;
public interface ExcepcionPeajeDAO extends GenericDAO<ExcepcionPeaje, Integer> {
public List<ExcepcionPeaje> buscar(String descconvenio, String cveconvenio);
}

View File

@ -0,0 +1,35 @@
package com.rjconsultores.ventaboletos.dao.hibernate;
import java.util.List;
import org.hibernate.Criteria;
import org.hibernate.SessionFactory;
import org.hibernate.criterion.Order;
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.ExcepcionPeajeDAO;
import com.rjconsultores.ventaboletos.entidad.ExcepcionPeaje;
@Repository("excepcionPeajeDAO")
public class ExcepcionPeajeHibernateDAO extends GenericHibernateDAO<ExcepcionPeaje, Integer>
implements ExcepcionPeajeDAO {
@Autowired
public ExcepcionPeajeHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
setSessionFactory(factory);
}
public List<ExcepcionPeaje> buscar(String descconvenio, String cveconvenio) {
Criteria c = getSession().createCriteria(getPersistentClass());
c.add(Restrictions.eq("activo", Boolean.TRUE));
c.add(Restrictions.eq("descconvenio", descconvenio));
c.add(Restrictions.eq("cveconvenio", cveconvenio));
c.addOrder(Order.asc("descconvenio"));
return c.list();
}
}

View File

@ -0,0 +1,108 @@
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.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
@Entity
@SequenceGenerator(name = "EXCEPCION_PEAJE_SEQ", sequenceName = "EXCEPCION_PEAJE_SEQ", allocationSize = 1)
@Table(name = "EXCEPCION_PEAJE")
public class ExcepcionPeaje implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Basic(optional = false)
@Column(name = "EXCEPCIONPEAJE_ID")
@GeneratedValue(strategy = GenerationType.AUTO, generator = "EXCEPCION_PEAJE_SEQ")
private Integer excepcionPeajeId;
@Column(name = "ACTIVO")
private Boolean activo;
@Column(name = "FECMODIF")
@Temporal(TemporalType.TIMESTAMP)
private Date fecmodif;
@Column(name = "USUARIO_ID")
private Integer usuarioId;
@JoinColumn(name = "RUTA_ID")
@OneToOne
private Ruta ruta;
@OneToOne
@JoinColumn(name = "ORIGEN_ID")
private Parada origem;
@OneToOne
@JoinColumn(name = "DESTINO_ID")
private Parada destino;
@OneToMany(mappedBy = "excepcionPeaje", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
private List<ExcepcionPeajeVigencia> lsExcepcionPeajeVigencia;
public Integer getExcepcionPeajeId() {
return excepcionPeajeId;
}
public void setExcepcionPeajeId(Integer excepcionPeajeId) {
this.excepcionPeajeId = excepcionPeajeId;
}
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 Ruta getRuta() {
return ruta;
}
public void setRuta(Ruta ruta) {
this.ruta = ruta;
}
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 List<ExcepcionPeajeVigencia> getLsExcepcionPeajeVigencia() {
return lsExcepcionPeajeVigencia;
}
public void setLsExcepcionPeajeVigencia(List<ExcepcionPeajeVigencia> lsExcepcionPeajeVigencia) {
this.lsExcepcionPeajeVigencia = lsExcepcionPeajeVigencia;
}
@Override
public String toString() {
return "com.rjconsultores.ventaboletos.entidad.ExcepcionPeaje[excepcionPeajeId=" + excepcionPeajeId + "]";
}
}

View File

@ -0,0 +1,246 @@
package com.rjconsultores.ventaboletos.entidad;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
@Entity
@SequenceGenerator(name = "EXCEPCION_PEAJE_VIGENCIA_SEQ", sequenceName = "EXCEPCION_PEAJE_VIGENCIA_SEQ", allocationSize = 1)
@Table(name = "EXCEPCION_PEAJE_VIGENCIA")
public class ExcepcionPeajeVigencia implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Basic(optional = false)
@Column(name = "EXCEPCIONPEAJEVIGENCIA_ID")
@GeneratedValue(strategy = GenerationType.AUTO, generator = "EXCEPCION_PEAJE_VIGENCIA_SEQ")
private Integer excepcionPeajeVigenciaId;
@Column(name = "ACTIVO")
private Boolean activo;
@Column(name = "FECMODIF")
@Temporal(TemporalType.TIMESTAMP)
private Date fecmodif;
@Column(name = "USUARIO_ID")
private Integer usuarioId;
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "EXCEPCIONPEAJE_ID" , referencedColumnName = "EXCEPCIONPEAJE_ID")
private ExcepcionPeaje excepcionPeaje;
@Column(name = "FECHAVENTAINI")
@Temporal(TemporalType.TIMESTAMP)
private java.util.Date fecVentaIni;
@Column(name = "FECHAVENTAFIN")
@Temporal(TemporalType.TIMESTAMP)
private java.util.Date fecVentaFin;
@Column(name = "FECHORINICIO")
@Temporal(TemporalType.TIME)
private Date horaIni;
@Column(name = "FECHORFINAL")
@Temporal(TemporalType.TIME)
private Date horaFin;
@Column(name = "INDLUNES")
private Boolean INDLUNES;
@Column(name = "INDMARTES")
private Boolean INDMARTES;
@Column(name = "INDMIERCOLES")
private Boolean INDMIERCOLES;
@Column(name = "INDJUEVES")
private Boolean INDJUEVES;
@Column(name = "INDVIERNES")
private Boolean INDVIERNES;
@Column(name = "INDSABADO")
private Boolean INDSABADO;
@Column(name = "INDDOMINGO")
private Boolean INDDOMINGO;
@Column(name = "PRECIO")
private BigDecimal precio;
public Integer getExcepcionPeajeVigenciaId() {
return excepcionPeajeVigenciaId;
}
public void setExcepcionPeajeVigenciaId(Integer excepcionPeajeVigenciaId) {
this.excepcionPeajeVigenciaId = excepcionPeajeVigenciaId;
}
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 ExcepcionPeaje getExcepcionPeaje() {
return excepcionPeaje;
}
public void setExcepcionPeaje(ExcepcionPeaje excepcionPeaje) {
this.excepcionPeaje = excepcionPeaje;
}
public java.util.Date getFecVentaIni() {
return fecVentaIni;
}
public void setFecVentaIni(java.util.Date fecVentaIni) {
this.fecVentaIni = fecVentaIni;
}
public java.util.Date getFecVentaFin() {
return fecVentaFin;
}
public void setFecVentaFin(java.util.Date fecVentaFin) {
this.fecVentaFin = fecVentaFin;
}
public Date getHoraIni() {
return horaIni;
}
public void setHoraIni(Date horaIni) {
this.horaIni = horaIni;
}
public Date getHoraFin() {
return horaFin;
}
public void setHoraFin(Date horaFin) {
this.horaFin = horaFin;
}
public Boolean getINDLUNES() {
return INDLUNES;
}
public void setINDLUNES(Boolean iNDLUNES) {
INDLUNES = iNDLUNES;
}
public Boolean getINDMARTES() {
return INDMARTES;
}
public void setINDMARTES(Boolean iNDMARTES) {
INDMARTES = iNDMARTES;
}
public Boolean getINDMIERCOLES() {
return INDMIERCOLES;
}
public void setINDMIERCOLES(Boolean iNDMIERCOLES) {
INDMIERCOLES = iNDMIERCOLES;
}
public Boolean getINDJUEVES() {
return INDJUEVES;
}
public void setINDJUEVES(Boolean iNDJUEVES) {
INDJUEVES = iNDJUEVES;
}
public Boolean getINDVIERNES() {
return INDVIERNES;
}
public void setINDVIERNES(Boolean iNDVIERNES) {
INDVIERNES = iNDVIERNES;
}
public Boolean getINDSABADO() {
return INDSABADO;
}
public void setINDSABADO(Boolean iNDSABADO) {
INDSABADO = iNDSABADO;
}
public Boolean getINDDOMINGO() {
return INDDOMINGO;
}
public void setINDDOMINGO(Boolean iNDDOMINGO) {
INDDOMINGO = iNDDOMINGO;
}
public BigDecimal getPrecio() {
return precio;
}
public void setPrecio(BigDecimal precio) {
this.precio = precio;
}
@Override
public String toString() {
return "com.rjconsultores.ventaboletos.entidad.ExcepcionPeajeVigencia[excepcionPeajeVigenciaId=" + excepcionPeajeVigenciaId + "]";
}
}

View File

@ -0,0 +1,11 @@
package com.rjconsultores.ventaboletos.service;
import java.util.List;
import com.rjconsultores.ventaboletos.entidad.ExcepcionPeaje;
public interface ExcepcionPeajeService extends GenericService<ExcepcionPeaje, Integer> {
public List<ExcepcionPeaje> buscar(String descconvenio, String cveconvenio);
}

View File

@ -0,0 +1,85 @@
package com.rjconsultores.ventaboletos.service.impl;
import java.util.ArrayList;
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.ExcepcionPeajeDAO;
import com.rjconsultores.ventaboletos.entidad.ExcepcionPeaje;
import com.rjconsultores.ventaboletos.service.ExcepcionPeajeService;
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
@Service("excepcionPeajeService")
public class ExcepcionPeajeServiceImpl implements ExcepcionPeajeService {
@Autowired
private ExcepcionPeajeDAO excepcionPeajeDAO;
public ExcepcionPeaje obtenerID(Integer id) {
return excepcionPeajeDAO.obtenerID(id);
}
public List<ExcepcionPeaje> obtenerTodos() {
return excepcionPeajeDAO.obtenerTodos();
}
public List<ExcepcionPeaje> buscar(String descconvenio, String cveconvenio){
return new ArrayList<ExcepcionPeaje>();
}
@Transactional
public ExcepcionPeaje suscribir(ExcepcionPeaje entidad) {
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
entidad.setFecmodif(Calendar.getInstance().getTime());
entidad.setActivo(Boolean.TRUE);
return excepcionPeajeDAO.suscribir(entidad);
}
@Transactional
public ExcepcionPeaje actualizacion(ExcepcionPeaje entidad) {
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
entidad.setFecmodif(Calendar.getInstance().getTime());
entidad.setActivo(Boolean.TRUE);
return excepcionPeajeDAO.actualizacion(entidad);
}
@Transactional
public void borrar(ExcepcionPeaje entidad) {
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
entidad.setFecmodif(Calendar.getInstance().getTime());
entidad.setActivo(Boolean.FALSE);
// for (ConvenioDet cd : entidad.getConvenioDetList()) {
// cd.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
// cd.setFecmodif(Calendar.getInstance().getTime());
// cd.setActivo(Boolean.FALSE);
// }
//
// for (ConvenioPuntoVenta cpv: entidad.getConvenioPuntoVentaList()) {
// cpv.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
// cpv.setFecmodif(Calendar.getInstance().getTime());
// cpv.setActivo(Boolean.FALSE);
// }
//
// for (ConvenioUsuario cu : entidad.getConvenioUsuarioList()) {
// cu.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
// cu.setFecmodif(Calendar.getInstance().getTime());
// cu.setActivo(Boolean.FALSE);
// }
//
// for (ConvenioTramo ct : entidad.getConvenioTramoList()) {
// ct.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
// ct.setFecmodif(Calendar.getInstance().getTime());
// ct.setActivo(Boolean.FALSE);
// }
excepcionPeajeDAO.actualizacion(entidad);
}
}