0013746: Menu Dispositivo Venda Embarcada

fixes bug#13746
dev:Leo
qua:Jose

git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@91880 d1611594-4594-4d17-8e1d-87c2c4800839
master
fabricio.oliveira 2019-04-12 14:09:23 +00:00
parent bb77bd8964
commit 0fb448f1a4
6 changed files with 146 additions and 23 deletions

View File

@ -0,0 +1,17 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.rjconsultores.ventaboletos.dao;
import com.rjconsultores.ventaboletos.entidad.Boleto;
/**
*
* @author Fabricio
*/
public interface BoletoDAO extends GenericDAO<Boleto, Long> {
public Boleto buscarPeloImeiDoDispositivo(String imei);
}

View File

@ -0,0 +1,42 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.rjconsultores.ventaboletos.dao.hibernate;
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.BoletoDAO;
import com.rjconsultores.ventaboletos.entidad.Boleto;
/**
*
* @author Fabricio
*/
@Repository("boletoDAO")
public class BoletoHibernateDAO extends GenericHibernateDAO<Boleto, Long> implements BoletoDAO {
@Autowired
public BoletoHibernateDAO(@Qualifier("sessionFactory") SessionFactory factory) {
setSessionFactory(factory);
}
public Boleto buscarPeloImeiDoDispositivo(String imei) {
Criteria c = getSession().createCriteria(getPersistentClass());
c.add(Restrictions.eq("imeiDispositivoEmbarcada", imei));
c.add(Restrictions.eq("activo", Boolean.TRUE));
c.addOrder(Order.desc("fechorventa"));
c.setFirstResult(0);
c.setMaxResults(1);
return (Boleto) c.uniqueResult();
}
}

View File

@ -6,6 +6,9 @@ import java.util.Date;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Temporal; import javax.persistence.Temporal;
import javax.persistence.TemporalType; import javax.persistence.TemporalType;
@ -44,8 +47,9 @@ public class Boleto implements java.io.Serializable {
@Column(name = "DESTINO_ID", precision = 7, scale = 0) @Column(name = "DESTINO_ID", precision = 7, scale = 0)
private Integer destinoId; private Integer destinoId;
@Column(name = "PUNTOVENTA_ID", precision = 7, scale = 0) @JoinColumn(name = "PUNTOVENTA_ID", referencedColumnName = "PUNTOVENTA_ID")
private Integer puntoventaId; @ManyToOne
private PuntoVenta puntoVenta;
@Column(name = "CORRIDA_ID", precision = 7, scale = 0) @Column(name = "CORRIDA_ID", precision = 7, scale = 0)
private Integer corridaId; private Integer corridaId;
@ -196,8 +200,9 @@ public class Boleto implements java.io.Serializable {
@Column(name = "FECMODIF", length = 7) @Column(name = "FECMODIF", length = 7)
private Date fecmodif; private Date fecmodif;
@Column(name = "USUARIO_ID", precision = 7, scale = 0) @OneToOne
private Integer usuarioId; @JoinColumn(name = "USUARIO_ID", referencedColumnName = "USUARIO_ID")
private Usuario usuario;
@Column(name = "NODO_ID", precision = 2, scale = 0) @Column(name = "NODO_ID", precision = 2, scale = 0)
private Byte nodoId; private Byte nodoId;
@ -314,6 +319,9 @@ public class Boleto implements java.io.Serializable {
@Column(name = "ESTADOCIVIL_ID", precision = 2, scale = 0) @Column(name = "ESTADOCIVIL_ID", precision = 2, scale = 0)
private Byte estadocivilId; private Byte estadocivilId;
@Column(name = "IMEI_DISPOSITIVO_EMBARCADA", length = 20)
private String imeiDispositivoEmbarcada;
public Boleto() { public Boleto() {
} }
@ -322,7 +330,7 @@ public class Boleto implements java.io.Serializable {
} }
public Boleto(long boletoId, String numasiento, Integer categoriaId, String numfoliosistema, Byte claseservicioId, public Boleto(long boletoId, String numasiento, Integer categoriaId, String numfoliosistema, Byte claseservicioId,
Short marcaId, Integer origenId, Integer destinoId, Integer puntoventaId, Integer corridaId, Short marcaId, Integer origenId, Integer destinoId, PuntoVenta puntoVenta, Integer corridaId,
Date feccorrida, String nombpasajero, BigDecimal preciobase, BigDecimal preciopagado, Date feccorrida, String nombpasajero, BigDecimal preciobase, BigDecimal preciopagado,
BigDecimal descuentoamparado, Byte tipoventaId, String numseriepreimpresa, String numfoliopreimpreso, BigDecimal descuentoamparado, Byte tipoventaId, String numseriepreimpresa, String numfoliopreimpreso,
Date fechorviaje, Date fechorventa, BigDecimal numkmviaje, String numoperacion, String indstatusoperacion, Date fechorviaje, Date fechorventa, BigDecimal numkmviaje, String numoperacion, String indstatusoperacion,
@ -334,7 +342,7 @@ public class Boleto implements java.io.Serializable {
Long clientefidelidadId, Integer opcional1, Integer opcional2, String opcional3, Long clientefidelidadId, Integer opcional1, Integer opcional2, String opcional3,
BigDecimal preciocargoextra, BigDecimal porccategoria, BigDecimal preciopricing, Integer usuarioremotoId, BigDecimal preciocargoextra, BigDecimal porccategoria, BigDecimal preciopricing, Integer usuarioremotoId,
Integer puntoventaremotoId, Byte canttransferencia, String numdocdescuento, Boolean activo, Date fecmodif, Integer puntoventaremotoId, Byte canttransferencia, String numdocdescuento, Boolean activo, Date fecmodif,
Integer usuarioId, Byte nodoId, Long entregaboletoId, BigDecimal importecategoria, Integer clienteId, Usuario usuario, Byte nodoId, Long entregaboletoId, BigDecimal importecategoria, Integer clienteId,
Long boletooriginalId, BigDecimal importetaxaembarque, BigDecimal importepedagio, BigDecimal importeoutros, Long boletooriginalId, BigDecimal importetaxaembarque, BigDecimal importepedagio, BigDecimal importeoutros,
BigDecimal importeseguro, String descorgaodoc, String desctipodoc, String descnumdoc, String numfidelidad, BigDecimal importeseguro, String descorgaodoc, String desctipodoc, String descnumdoc, String numfidelidad,
String infopasajero, Boolean indconexion, Integer rutaId, Integer levanteId, String infopasajero, Boolean indconexion, Integer rutaId, Integer levanteId,
@ -351,7 +359,7 @@ public class Boleto implements java.io.Serializable {
this.marcaId = marcaId; this.marcaId = marcaId;
this.origenId = origenId; this.origenId = origenId;
this.destinoId = destinoId; this.destinoId = destinoId;
this.puntoventaId = puntoventaId; this.puntoVenta = puntoVenta;
this.corridaId = corridaId; this.corridaId = corridaId;
this.feccorrida = feccorrida; this.feccorrida = feccorrida;
this.nombpasajero = nombpasajero; this.nombpasajero = nombpasajero;
@ -400,7 +408,7 @@ public class Boleto implements java.io.Serializable {
this.numdocdescuento = numdocdescuento; this.numdocdescuento = numdocdescuento;
this.activo = activo; this.activo = activo;
this.fecmodif = fecmodif; this.fecmodif = fecmodif;
this.usuarioId = usuarioId; this.usuario = usuario;
this.nodoId = nodoId; this.nodoId = nodoId;
this.entregaboletoId = entregaboletoId; this.entregaboletoId = entregaboletoId;
this.importecategoria = importecategoria; this.importecategoria = importecategoria;
@ -505,12 +513,12 @@ public class Boleto implements java.io.Serializable {
this.destinoId = destinoId; this.destinoId = destinoId;
} }
public Integer getPuntoventaId() { public PuntoVenta getPuntoVenta() {
return this.puntoventaId; return puntoVenta;
} }
public void setPuntoventaId(Integer puntoventaId) { public void setPuntoVenta(PuntoVenta puntoVenta) {
this.puntoventaId = puntoventaId; this.puntoVenta = puntoVenta;
} }
public Integer getCorridaId() { public Integer getCorridaId() {
@ -897,12 +905,13 @@ public class Boleto implements java.io.Serializable {
this.fecmodif = fecmodif; this.fecmodif = fecmodif;
} }
public Integer getUsuarioId() {
return this.usuarioId; public Usuario getUsuario() {
return usuario;
} }
public void setUsuarioId(Integer usuarioId) { public void setUsuario(Usuario usuario) {
this.usuarioId = usuarioId; this.usuario = usuario;
} }
public Byte getNodoId() { public Byte getNodoId() {
@ -1209,4 +1218,12 @@ public class Boleto implements java.io.Serializable {
this.estadocivilId = estadocivilId; this.estadocivilId = estadocivilId;
} }
public String getImeiDispositivoEmbarcada() {
return imeiDispositivoEmbarcada;
}
public void setImeiDispositivoEmbarcada(String imeiDispositivoEmbarcada) {
this.imeiDispositivoEmbarcada = imeiDispositivoEmbarcada;
}
} }

View File

@ -15,6 +15,7 @@ import javax.persistence.Id;
import javax.persistence.JoinColumn; import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne; import javax.persistence.ManyToOne;
import javax.persistence.OneToMany; import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.SequenceGenerator; import javax.persistence.SequenceGenerator;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Temporal; import javax.persistence.Temporal;
@ -62,8 +63,9 @@ public class DispositivoEmbarcada {
@Column(name = "FECMODIF") @Column(name = "FECMODIF")
@Temporal(TemporalType.TIMESTAMP) @Temporal(TemporalType.TIMESTAMP)
private Date fecmodif; private Date fecmodif;
@Column(name = "USUARIO_ID") @OneToOne
private Integer usuarioId; @JoinColumn(name = "USUARIO_ID", referencedColumnName = "USUARIO_ID")
private Usuario usuario;
@OneToMany(mappedBy="dispositivoEmbarcada", cascade = CascadeType.ALL, fetch = FetchType.EAGER) @OneToMany(mappedBy="dispositivoEmbarcada", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
private List<CtrlSerieEmbarcada> series = new ArrayList<CtrlSerieEmbarcada>(); private List<CtrlSerieEmbarcada> series = new ArrayList<CtrlSerieEmbarcada>();
@ -159,11 +161,12 @@ public class DispositivoEmbarcada {
public void setFecmodif(Date fecmodif) { public void setFecmodif(Date fecmodif) {
this.fecmodif = fecmodif; this.fecmodif = fecmodif;
} }
public Integer getUsuarioId() {
return usuarioId; public Usuario getUsuario() {
return usuario;
} }
public void setUsuarioId(Integer usuarioId) { public void setUsuario(Usuario usuario) {
this.usuarioId = usuarioId; this.usuario = usuario;
} }
public List<CtrlSerieEmbarcada> getSeries() { public List<CtrlSerieEmbarcada> getSeries() {
return series; return series;

View File

@ -0,0 +1,16 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.rjconsultores.ventaboletos.service;
import com.rjconsultores.ventaboletos.entidad.Boleto;
/**
*
* @author Fabricio
*/
public interface BoletoService {
public Boleto buscarPeloImeiDoDispositivo(String imei);
}

View File

@ -0,0 +1,28 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.rjconsultores.ventaboletos.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.rjconsultores.ventaboletos.dao.BoletoDAO;
import com.rjconsultores.ventaboletos.entidad.Boleto;
import com.rjconsultores.ventaboletos.service.BoletoService;
/**
*
* @author Fabricio
*/
@Service("boletoService")
public class BoletoServiceImpl implements BoletoService {
@Autowired
private BoletoDAO boletoDAO;
public Boleto buscarPeloImeiDoDispositivo(String imei) {
return boletoDAO.buscarPeloImeiDoDispositivo(imei);
}
}