From d84e1547f95bc01c00984c851a5f2796d2154299 Mon Sep 17 00:00:00 2001 From: "daniel.zauli" Date: Thu, 15 Oct 2015 15:14:12 +0000 Subject: [PATCH] mantis #6716 git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@49021 d1611594-4594-4d17-8e1d-87c2c4800839 --- .../ventaboletos/dao/ExcepcionPeajeDAO.java | 9 + .../hibernate/ExcepcionPeajeHibernateDAO.java | 35 +++ .../ventaboletos/entidad/ExcepcionPeaje.java | 108 ++++++++ .../entidad/ExcepcionPeajeVigencia.java | 246 ++++++++++++++++++ .../service/ExcepcionPeajeService.java | 11 + .../impl/ExcepcionPeajeServiceImpl.java | 85 ++++++ 6 files changed, 494 insertions(+) create mode 100644 src/com/rjconsultores/ventaboletos/dao/ExcepcionPeajeDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/dao/hibernate/ExcepcionPeajeHibernateDAO.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ExcepcionPeaje.java create mode 100644 src/com/rjconsultores/ventaboletos/entidad/ExcepcionPeajeVigencia.java create mode 100644 src/com/rjconsultores/ventaboletos/service/ExcepcionPeajeService.java create mode 100644 src/com/rjconsultores/ventaboletos/service/impl/ExcepcionPeajeServiceImpl.java diff --git a/src/com/rjconsultores/ventaboletos/dao/ExcepcionPeajeDAO.java b/src/com/rjconsultores/ventaboletos/dao/ExcepcionPeajeDAO.java new file mode 100644 index 000000000..b03b97ed5 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/ExcepcionPeajeDAO.java @@ -0,0 +1,9 @@ +package com.rjconsultores.ventaboletos.dao; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ExcepcionPeaje; + +public interface ExcepcionPeajeDAO extends GenericDAO { + public List buscar(String descconvenio, String cveconvenio); +} diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ExcepcionPeajeHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ExcepcionPeajeHibernateDAO.java new file mode 100644 index 000000000..a3571b0fb --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ExcepcionPeajeHibernateDAO.java @@ -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 +implements ExcepcionPeajeDAO { + + @Autowired + public ExcepcionPeajeHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) { + setSessionFactory(factory); + } + + public List 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(); + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ExcepcionPeaje.java b/src/com/rjconsultores/ventaboletos/entidad/ExcepcionPeaje.java new file mode 100644 index 000000000..31c21d3bd --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ExcepcionPeaje.java @@ -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 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 getLsExcepcionPeajeVigencia() { + return lsExcepcionPeajeVigencia; + } + public void setLsExcepcionPeajeVigencia(List lsExcepcionPeajeVigencia) { + this.lsExcepcionPeajeVigencia = lsExcepcionPeajeVigencia; + } + @Override + public String toString() { + return "com.rjconsultores.ventaboletos.entidad.ExcepcionPeaje[excepcionPeajeId=" + excepcionPeajeId + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/entidad/ExcepcionPeajeVigencia.java b/src/com/rjconsultores/ventaboletos/entidad/ExcepcionPeajeVigencia.java new file mode 100644 index 000000000..95b4df123 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/entidad/ExcepcionPeajeVigencia.java @@ -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 + "]"; + } +} diff --git a/src/com/rjconsultores/ventaboletos/service/ExcepcionPeajeService.java b/src/com/rjconsultores/ventaboletos/service/ExcepcionPeajeService.java new file mode 100644 index 000000000..de1f717d2 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/ExcepcionPeajeService.java @@ -0,0 +1,11 @@ +package com.rjconsultores.ventaboletos.service; + +import java.util.List; + +import com.rjconsultores.ventaboletos.entidad.ExcepcionPeaje; + +public interface ExcepcionPeajeService extends GenericService { + + public List buscar(String descconvenio, String cveconvenio); + +} diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ExcepcionPeajeServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ExcepcionPeajeServiceImpl.java new file mode 100644 index 000000000..22c907565 --- /dev/null +++ b/src/com/rjconsultores/ventaboletos/service/impl/ExcepcionPeajeServiceImpl.java @@ -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 obtenerTodos() { + return excepcionPeajeDAO.obtenerTodos(); + } + + public List buscar(String descconvenio, String cveconvenio){ + return new ArrayList(); + } + + @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); + } + +}