fixes bug#23106
qua: dev:Valdir git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@109257 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
66128b32ed
commit
798477408b
|
@ -80,6 +80,6 @@ public enum TipoEventoExtra {
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "TAXA_CONVENIENCIA_SVI";
|
return "TAXA_CONVENIENCIA_SVI";
|
||||||
}
|
}
|
||||||
};;
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,4 +17,9 @@ import com.rjconsultores.ventaboletos.vo.embarcada.PtoVtaUsuarioUltimaVendaDispo
|
||||||
public interface BoletoDAO extends GenericDAO<Boleto, Long> {
|
public interface BoletoDAO extends GenericDAO<Boleto, Long> {
|
||||||
public Boleto buscarPeloImeiDoDispositivo(String imei);
|
public Boleto buscarPeloImeiDoDispositivo(String imei);
|
||||||
public List<PtoVtaUsuarioUltimaVendaDispositivoVO> buscarUltimaVendaDosDispositivosEmbarcada();
|
public List<PtoVtaUsuarioUltimaVendaDispositivoVO> buscarUltimaVendaDosDispositivosEmbarcada();
|
||||||
|
@Override
|
||||||
|
Boleto suscribir(Boleto boleto);
|
||||||
|
public String getSequenciaBoletoId();
|
||||||
|
public String getSequenciaNumOperacion();
|
||||||
|
public String getSequenciaNumReservacion();
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
package com.rjconsultores.ventaboletos.dao;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ReservaEspecialCliente;
|
||||||
|
|
||||||
|
public interface ReservaEspecialClienteDAO extends GenericDAO<ReservaEspecialCliente, Integer> {
|
||||||
|
|
||||||
|
public List<ReservaEspecialCliente> bucarReservaEspecialByClienteId(Long clienteId) ;
|
||||||
|
public List<ReservaEspecialCliente> bucarReservaEspecialByCorridaId(Long corridaId) ;
|
||||||
|
}
|
|
@ -65,4 +65,21 @@ public class BoletoHibernateDAO extends GenericHibernateDAO<Boleto, Long> implem
|
||||||
return (Boleto) c.uniqueResult();
|
return (Boleto) c.uniqueResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getSequenciaBoletoId(){
|
||||||
|
String sql = "SELECT BOLETO_SEQ.nextval FROM DUAL";
|
||||||
|
Object o = this.getSession().createSQLQuery(sql).uniqueResult();
|
||||||
|
return o.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSequenciaNumOperacion(){
|
||||||
|
String sql = "SELECT NUMEOPERACION_SEQ.nextval FROM DUAL";
|
||||||
|
Object o = this.getSession().createSQLQuery(sql).uniqueResult();
|
||||||
|
return o.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSequenciaNumReservacion(){
|
||||||
|
String sql = "SELECT NUMERESERVACION_SEQ.nextval FROM DUAL";
|
||||||
|
Object o = this.getSession().createSQLQuery(sql).uniqueResult();
|
||||||
|
return o.toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
*/
|
*/
|
||||||
package com.rjconsultores.ventaboletos.dao.hibernate;
|
package com.rjconsultores.ventaboletos.dao.hibernate;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
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.ReservaEspecialClienteDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ReservaEspecialCliente;
|
||||||
|
|
||||||
|
@Repository("reservaEspecialClienteDAO")
|
||||||
|
public class ReservaEspecialClienteHibernateDAO extends GenericHibernateDAO<ReservaEspecialCliente, Integer>
|
||||||
|
implements ReservaEspecialClienteDAO {
|
||||||
|
|
||||||
|
private static final String FIELD_ACTIVO = "activo";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
public ReservaEspecialClienteHibernateDAO(
|
||||||
|
@Qualifier("sessionFactory") SessionFactory factory) {
|
||||||
|
setSessionFactory(factory);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ReservaEspecialCliente> bucarReservaEspecialByClienteId(Long clienteId) {
|
||||||
|
Criteria c = getCriteriaClienteActivo();
|
||||||
|
c.addOrder(Order.asc("reservaEspecialClienteId"));
|
||||||
|
|
||||||
|
return c.list();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private Criteria getCriteriaClienteActivo() {
|
||||||
|
Criteria criteria = getSession().createCriteria(getPersistentClass());
|
||||||
|
criteria.add(Restrictions.eq(FIELD_ACTIVO, Boolean.TRUE));
|
||||||
|
return criteria;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ReservaEspecialCliente> bucarReservaEspecialByCorridaId(Long corridaId) {
|
||||||
|
Criteria c = getCriteriaClienteActivo();
|
||||||
|
c.add(Restrictions.eq("corridaId", corridaId));
|
||||||
|
c.addOrder(Order.asc("reservaEspecialClienteId"));
|
||||||
|
return c.list();
|
||||||
|
}
|
||||||
|
}
|
|
@ -87,6 +87,10 @@ public class Boleto implements java.io.Serializable {
|
||||||
@Column(name = "FECHORVENTA", length = 7)
|
@Column(name = "FECHORVENTA", length = 7)
|
||||||
private Date fechorventa;
|
private Date fechorventa;
|
||||||
|
|
||||||
|
@Temporal(TemporalType.DATE)
|
||||||
|
@Column(name = "FECHORVENTA_H", length = 7)
|
||||||
|
private Date fechorventaH;
|
||||||
|
|
||||||
@Column(name = "NUMKMVIAJE", precision = 7)
|
@Column(name = "NUMKMVIAJE", precision = 7)
|
||||||
private BigDecimal numkmviaje;
|
private BigDecimal numkmviaje;
|
||||||
|
|
||||||
|
@ -322,6 +326,10 @@ public class Boleto implements java.io.Serializable {
|
||||||
@Column(name = "IMEI_DISPOSITIVO_EMBARCADA", length = 20)
|
@Column(name = "IMEI_DISPOSITIVO_EMBARCADA", length = 20)
|
||||||
private String imeiDispositivoEmbarcada;
|
private String imeiDispositivoEmbarcada;
|
||||||
|
|
||||||
|
@Column(name = "TEMPORESERVAFIDELIDADE", length = 7)
|
||||||
|
private Integer temporeservafidelidade;
|
||||||
|
|
||||||
|
|
||||||
public Boleto() {
|
public Boleto() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1226,4 +1234,19 @@ public class Boleto implements java.io.Serializable {
|
||||||
this.imeiDispositivoEmbarcada = imeiDispositivoEmbarcada;
|
this.imeiDispositivoEmbarcada = imeiDispositivoEmbarcada;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Integer getTemporeservafidelidade() {
|
||||||
|
return temporeservafidelidade;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTemporeservafidelidade(Integer temporeservafidelidade) {
|
||||||
|
this.temporeservafidelidade = temporeservafidelidade;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getFechorventaH() {
|
||||||
|
return fechorventaH;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFechorventaH(Date fechorventaH) {
|
||||||
|
this.fechorventaH = fechorventaH;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,6 +147,19 @@ public class Cliente implements Serializable {
|
||||||
@Temporal(TemporalType.DATE)
|
@Temporal(TemporalType.DATE)
|
||||||
private Date fecbloqueiopcd;
|
private Date fecbloqueiopcd;
|
||||||
|
|
||||||
|
@OneToMany(cascade = CascadeType.ALL)
|
||||||
|
@JoinColumn(name = "CLIENTE_ID", referencedColumnName = "CLIENTE_ID")
|
||||||
|
@Where(clause = "activo=1")
|
||||||
|
private List<ReservaEspecialCliente> listReservaEspecialCliente;
|
||||||
|
|
||||||
|
public List<ReservaEspecialCliente> getListReservaEspecialCliente() {
|
||||||
|
return listReservaEspecialCliente;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setListReservaEspecialCliente(List<ReservaEspecialCliente> listReservaEspecialCliente) {
|
||||||
|
this.listReservaEspecialCliente = listReservaEspecialCliente;
|
||||||
|
}
|
||||||
|
|
||||||
public Cliente() {
|
public Cliente() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,270 @@
|
||||||
|
package com.rjconsultores.ventaboletos.entidad;
|
||||||
|
|
||||||
|
import java.util.Calendar;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import javax.persistence.Basic;
|
||||||
|
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;
|
||||||
|
import javax.persistence.Temporal;
|
||||||
|
import javax.persistence.TemporalType;
|
||||||
|
|
||||||
|
@Entity
|
||||||
|
@SequenceGenerator(name = "RESERVA_ESPECIAL_CLIENTE_SEQ", sequenceName = "RESERVA_ESPECIAL_CLIENTE_SEQ", allocationSize = 1)
|
||||||
|
@Table(name = "RESERVA_ESPECIAL_CLIENTE")
|
||||||
|
public class ReservaEspecialCliente {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@Basic(optional = false)
|
||||||
|
@GeneratedValue(strategy = GenerationType.AUTO, generator = "RESERVA_ESPECIAL_CLIENTE_SEQ")
|
||||||
|
@Column(name = "RESERVAESPECIALCLIENTE_ID")
|
||||||
|
private Long reservaEspecialClienteId;
|
||||||
|
|
||||||
|
//Cliente
|
||||||
|
@Basic(optional = false)
|
||||||
|
@Column(name = "CLIENTE_ID")
|
||||||
|
private Long clienteId;
|
||||||
|
|
||||||
|
//Corrida
|
||||||
|
@Basic(optional = false)
|
||||||
|
@Column(name = "CORRIDA_ID")
|
||||||
|
private Long corridaId;
|
||||||
|
|
||||||
|
//Origem trecho
|
||||||
|
@Basic(optional = false)
|
||||||
|
@JoinColumn(name = "ORIGEM_ID", referencedColumnName = "PARADA_ID")
|
||||||
|
@ManyToOne
|
||||||
|
private Parada origem;
|
||||||
|
|
||||||
|
//Destino trecho
|
||||||
|
@Basic(optional = false)
|
||||||
|
@JoinColumn(name = "DESTINO_ID", referencedColumnName = "PARADA_ID")
|
||||||
|
@ManyToOne
|
||||||
|
private Parada destino;
|
||||||
|
|
||||||
|
//Data Final Vigência
|
||||||
|
@Basic(optional = false)
|
||||||
|
@Column(name = "FECINICIO")
|
||||||
|
@Temporal(TemporalType.TIMESTAMP)
|
||||||
|
private Date fecinicio;
|
||||||
|
|
||||||
|
//Data Final Vigência
|
||||||
|
@Basic(optional = false)
|
||||||
|
@Column(name = "FECFINAL")
|
||||||
|
@Temporal(TemporalType.TIMESTAMP)
|
||||||
|
private Date fecfinal;
|
||||||
|
|
||||||
|
//Dias da Semana
|
||||||
|
@Column(name = "NUMASENTOCORRIDA")
|
||||||
|
private Short numAsentoCorrida;
|
||||||
|
@Column(name = "INDSEGUNDA")
|
||||||
|
private Boolean indSegunda;
|
||||||
|
@Column(name = "INDTERCA")
|
||||||
|
private Boolean indTerca;
|
||||||
|
@Column(name = "INDQUARTA")
|
||||||
|
private Boolean indQuarta;
|
||||||
|
@Column(name = "INDQUINTA")
|
||||||
|
private Boolean indQuinta;
|
||||||
|
@Column(name = "INDSEXTA")
|
||||||
|
private Boolean indSexta;
|
||||||
|
@Column(name = "INDSABADO")
|
||||||
|
private Boolean indSabado;
|
||||||
|
@Column(name = "INDDOMINGO")
|
||||||
|
private Boolean indDomingo;
|
||||||
|
|
||||||
|
//FecModif
|
||||||
|
@Basic(optional = false)
|
||||||
|
@Column(name = "FECMODIF")
|
||||||
|
@Temporal(TemporalType.TIMESTAMP)
|
||||||
|
private Date fecmodif;
|
||||||
|
|
||||||
|
//Activo
|
||||||
|
@Column(name = "ACTIVO")
|
||||||
|
private Boolean activo;
|
||||||
|
|
||||||
|
//Usuario
|
||||||
|
@Column(name = "USUARIO_ID")
|
||||||
|
private Integer usuarioId;
|
||||||
|
|
||||||
|
@Column(name = "TEMPOCONFIRMACAO")
|
||||||
|
@Temporal(TemporalType.TIMESTAMP)
|
||||||
|
private Date tempoConfirmacao;
|
||||||
|
|
||||||
|
public Date getTempoConfirmacao() {
|
||||||
|
return tempoConfirmacao;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTempoConfirmacao(Date tempoConfirmacao) {
|
||||||
|
this.tempoConfirmacao = tempoConfirmacao;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getReservaEspecialClienteId() {
|
||||||
|
return reservaEspecialClienteId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReservaEspecialClienteId(Long reservaEspecialClienteId) {
|
||||||
|
this.reservaEspecialClienteId = reservaEspecialClienteId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getClienteId() {
|
||||||
|
return clienteId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setClienteId(Long clienteId) {
|
||||||
|
this.clienteId = clienteId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getCorridaId() {
|
||||||
|
return corridaId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCorridaId(Long corridaId) {
|
||||||
|
this.corridaId = corridaId;
|
||||||
|
}
|
||||||
|
|
||||||
|
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 Date getFecinicio() {
|
||||||
|
return fecinicio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFecinicio(Date fecinicio) {
|
||||||
|
this.fecinicio = fecinicio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getFecfinal() {
|
||||||
|
return fecfinal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFecfinal(Date fecfinal) {
|
||||||
|
this.fecfinal = fecfinal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Short getNumAsentoCorrida() {
|
||||||
|
return numAsentoCorrida;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNumAsentoCorrida(Short numAsentoCorrida) {
|
||||||
|
this.numAsentoCorrida = numAsentoCorrida;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getIndSegunda() {
|
||||||
|
return indSegunda;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIndSegunda(Boolean indSegunda) {
|
||||||
|
this.indSegunda = indSegunda;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getIndTerca() {
|
||||||
|
return indTerca;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIndTerca(Boolean indTerca) {
|
||||||
|
this.indTerca = indTerca;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getIndQuarta() {
|
||||||
|
return indQuarta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIndQuarta(Boolean indQuarta) {
|
||||||
|
this.indQuarta = indQuarta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getIndQuinta() {
|
||||||
|
return indQuinta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIndQuinta(Boolean indQuinta) {
|
||||||
|
this.indQuinta = indQuinta;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Boolean getIndSexta() {
|
||||||
|
return indSabado;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIndSexta(Boolean indSexta) {
|
||||||
|
this.indSabado = indSexta;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getIndDomingo() {
|
||||||
|
return indDomingo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIndDomingo(Boolean indDomingo) {
|
||||||
|
this.indDomingo = indDomingo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getFecmodif() {
|
||||||
|
return fecmodif;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFecmodif(Date fecmodif) {
|
||||||
|
this.fecmodif = fecmodif;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getActivo() {
|
||||||
|
return activo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setActivo(Boolean activo) {
|
||||||
|
this.activo = activo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getUsuarioId() {
|
||||||
|
return usuarioId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUsuarioId(Integer usuarioId) {
|
||||||
|
this.usuarioId = usuarioId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getIndSabado() {
|
||||||
|
return indSabado;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIndSabado(Boolean indSabado) {
|
||||||
|
this.indSabado = indSabado;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTempoConfirmacao(Integer hora, Integer minuto) {
|
||||||
|
Calendar c = Calendar.getInstance();
|
||||||
|
c.set(Calendar.YEAR, 1970);
|
||||||
|
c.set(Calendar.DAY_OF_MONTH, 1);
|
||||||
|
c.set(Calendar.MONTH, 0);
|
||||||
|
c.set(Calendar.HOUR_OF_DAY, 0);
|
||||||
|
c.set(Calendar.MINUTE, 0);
|
||||||
|
c.set(Calendar.MILLISECOND, 0);
|
||||||
|
c.set(Calendar.SECOND, 0);
|
||||||
|
c.set(Calendar.HOUR_OF_DAY, 0);
|
||||||
|
c.set(Calendar.MINUTE, 0);
|
||||||
|
c.add(Calendar.HOUR_OF_DAY, hora);
|
||||||
|
c.add(Calendar.MINUTE, minuto);
|
||||||
|
|
||||||
|
setTempoConfirmacao(c.getTime());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -61,6 +61,11 @@ public class VigenciaTarifa implements Serializable {
|
||||||
this.vigenciatarifaId = vigenciatarifaId;
|
this.vigenciatarifaId = vigenciatarifaId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public VigenciaTarifa(Date inicioVigencia, Date fimVigencia) {
|
||||||
|
feciniciovigencia = inicioVigencia;
|
||||||
|
fecfinvigencia = fimVigencia;
|
||||||
|
}
|
||||||
|
|
||||||
public Integer getVigenciatarifaId() {
|
public Integer getVigenciatarifaId() {
|
||||||
return vigenciatarifaId;
|
return vigenciatarifaId;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
*/
|
*/
|
||||||
package com.rjconsultores.ventaboletos.service;
|
package com.rjconsultores.ventaboletos.service;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
import com.rjconsultores.ventaboletos.entidad.Boleto;
|
import com.rjconsultores.ventaboletos.entidad.Boleto;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -13,4 +15,9 @@ import com.rjconsultores.ventaboletos.entidad.Boleto;
|
||||||
public interface BoletoService {
|
public interface BoletoService {
|
||||||
|
|
||||||
public Boleto buscarPeloImeiDoDispositivo(String imei);
|
public Boleto buscarPeloImeiDoDispositivo(String imei);
|
||||||
|
|
||||||
|
public Boleto suscribir(Boleto boleto);
|
||||||
|
|
||||||
|
public void criaBoletoReserva(String unoAsientoSelec, Integer unaCorridaId, Date unaFecCorrida, Integer unoTerminalOrigenId, Integer unoTerminalDestinoId, Integer unoTipoVenta, Integer unaCategoriaSelec, String unoNumeOperacion, Integer unUsuarioId, Integer unPuntoVenta, Integer unClienteId, Integer rutaId, Float tarifa, Long tempoReserva, Integer estacionId, String cpf, String numFidelidade, Integer claseservicioId, Short marcaId, Date fecViaje, Integer empresaCorridaId, String nombPassageiro) throws Exception;
|
||||||
|
|
||||||
}
|
}
|
|
@ -25,4 +25,6 @@ public interface ConstanteService extends GenericService<Constante, Integer> {
|
||||||
public List<Constante> buscarPorNomeConstanteLike(String nomeConstante);
|
public List<Constante> buscarPorNomeConstanteLike(String nomeConstante);
|
||||||
|
|
||||||
public String buscarURLAPI();
|
public String buscarURLAPI();
|
||||||
|
|
||||||
|
public Integer buscarValorConstantePorNomeConstante(String nomeConstante);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
/*
|
||||||
|
* 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.ReservaEspecialCliente;
|
||||||
|
|
||||||
|
public interface ReservaEspecialClienteService extends GenericService<ReservaEspecialCliente, Integer> {
|
||||||
|
|
||||||
|
public List<ReservaEspecialCliente> bucarReservaEspecialByClienteId(Long clienteId) ;
|
||||||
|
|
||||||
|
public List<ReservaEspecialCliente> bucarReservaEspecialByCorridaId(Long corridaId) ;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -4,12 +4,24 @@
|
||||||
*/
|
*/
|
||||||
package com.rjconsultores.ventaboletos.service.impl;
|
package com.rjconsultores.ventaboletos.service.impl;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import com.rjconsultores.ventaboletos.constantes.Constantes;
|
||||||
import com.rjconsultores.ventaboletos.dao.BoletoDAO;
|
import com.rjconsultores.ventaboletos.dao.BoletoDAO;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Boleto;
|
import com.rjconsultores.ventaboletos.entidad.Boleto;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.RutaCombinacion;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Usuario;
|
||||||
import com.rjconsultores.ventaboletos.service.BoletoService;
|
import com.rjconsultores.ventaboletos.service.BoletoService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.PuntoVentaService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.RutaCombinacionService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.UsuarioService;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.MoneyHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -21,8 +33,128 @@ public class BoletoServiceImpl implements BoletoService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private BoletoDAO boletoDAO;
|
private BoletoDAO boletoDAO;
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private PuntoVentaService puntoVentaService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UsuarioService usuarioService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RutaCombinacionService rutaCombinacionService;
|
||||||
|
|
||||||
|
|
||||||
public Boleto buscarPeloImeiDoDispositivo(String imei) {
|
public Boleto buscarPeloImeiDoDispositivo(String imei) {
|
||||||
return boletoDAO.buscarPeloImeiDoDispositivo(imei);
|
return boletoDAO.buscarPeloImeiDoDispositivo(imei);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public Boleto suscribir(Boleto boleto) {
|
||||||
|
return boletoDAO.suscribir(boleto);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void criaBoletoReserva(String unoAsientoSelec, Integer unaCorridaId, Date unaFecCorrida,
|
||||||
|
Integer unoTerminalOrigenId, Integer unoTerminalDestinoId, Integer unoTipoVenta, Integer unaCategoriaSelec,
|
||||||
|
String unoNumeOperacion, Integer unUsuarioId, Integer unPuntoVenta,
|
||||||
|
Integer unClienteId, Integer rutaId, Float tarifa, Long tempoReserva,
|
||||||
|
Integer estacionId, String docCPF, String numFidelidade, Integer claseservicioId, Short marcaId, Date fecViaje, Integer empresaCorridaId, String nombPassageiro) throws Exception {
|
||||||
|
|
||||||
|
PuntoVenta miPuntoVenta = puntoVentaService.obtenerID(unPuntoVenta.intValue());
|
||||||
|
|
||||||
|
Boleto miBoletoTemporal = new Boleto();
|
||||||
|
miBoletoTemporal.setActivo(Boolean.TRUE);
|
||||||
|
BigDecimal miPrecio = MoneyHelper.arredondar(tarifa) ;
|
||||||
|
miBoletoTemporal = new Boleto();
|
||||||
|
miBoletoTemporal.setBoletoId(formataBoletoId(getSequenciaBoletoId()));
|
||||||
|
miBoletoTemporal.setBoletooriginalId(miBoletoTemporal.getBoletoId());
|
||||||
|
// Sempre Categoria Normal (1)
|
||||||
|
miBoletoTemporal.setCategoriaId(Constantes.TPV_DIRECTO_NORMAL.intValue() );
|
||||||
|
miBoletoTemporal.setClienteId(unClienteId);
|
||||||
|
miBoletoTemporal.setClaseservicioId(claseservicioId.byteValue());
|
||||||
|
miBoletoTemporal.setDestinoId(unoTerminalDestinoId);
|
||||||
|
miBoletoTemporal.setDesctipodoc("CPF");
|
||||||
|
miBoletoTemporal.setDescnumdoc(docCPF);
|
||||||
|
miBoletoTemporal.setEmpresacorridaId(empresaCorridaId);
|
||||||
|
miBoletoTemporal.setEmpresapuntoventaId(miPuntoVenta.getEmpresa().getEmpresaId());
|
||||||
|
miBoletoTemporal.setEstacionId(estacionId);
|
||||||
|
miBoletoTemporal.setFeccreacion(new Date());
|
||||||
|
miBoletoTemporal.setFecmodif(new Date());
|
||||||
|
miBoletoTemporal.setFechorventa(new Date());
|
||||||
|
miBoletoTemporal.setFechorventaH(new Date());
|
||||||
|
miBoletoTemporal.setFechorviaje(fecViaje);
|
||||||
|
miBoletoTemporal.setFeccorrida(unaFecCorrida);
|
||||||
|
miBoletoTemporal.setCorridaId(unaCorridaId);
|
||||||
|
miBoletoTemporal.setIndcancelacion(Boolean.FALSE);
|
||||||
|
miBoletoTemporal.setIndreimpresion(Boolean.FALSE);
|
||||||
|
miBoletoTemporal.setIndextraviado(Boolean.FALSE);
|
||||||
|
miBoletoTemporal.setIndstatusoperacion("F");
|
||||||
|
miBoletoTemporal.setIndcancelacion(Boolean.FALSE);
|
||||||
|
miBoletoTemporal.setIndreplica(Boolean.FALSE);
|
||||||
|
miBoletoTemporal.setIndstatusboleto("S");
|
||||||
|
miBoletoTemporal.setIndreimpresion(Boolean.FALSE);
|
||||||
|
miBoletoTemporal.setImportetaxaembarque(BigDecimal.ZERO);
|
||||||
|
miBoletoTemporal.setImporteseguro(BigDecimal.ZERO);
|
||||||
|
miBoletoTemporal.setImportepedagio(BigDecimal.ZERO);
|
||||||
|
miBoletoTemporal.setImporteoutros(BigDecimal.ZERO);
|
||||||
|
miBoletoTemporal.setMarcaId(marcaId);
|
||||||
|
miBoletoTemporal.setNodoId((byte) 1);
|
||||||
|
miBoletoTemporal.setNumkmviaje(
|
||||||
|
calcularKmViaje(rutaId, unoTerminalOrigenId, unoTerminalDestinoId));
|
||||||
|
miBoletoTemporal.setNombpasajero(nombPassageiro);
|
||||||
|
miBoletoTemporal.setNumasiento(unoAsientoSelec);
|
||||||
|
miBoletoTemporal.setNumfidelidad(numFidelidade);
|
||||||
|
miBoletoTemporal.setNumoperacion(formataNumOperacion(getSequenciaNumOperacion()));
|
||||||
|
miBoletoTemporal.setNumreservacion(formataNumReservacion(getSequenciaNumReservacion()));
|
||||||
|
miBoletoTemporal.setOrigenId(unoTerminalOrigenId);
|
||||||
|
miBoletoTemporal.setPreciopricing(BigDecimal.ZERO);
|
||||||
|
miBoletoTemporal.setPorccategoria(null);
|
||||||
|
miBoletoTemporal.setPreciopagado(miPrecio);
|
||||||
|
miBoletoTemporal.setPreciobase(miPrecio);
|
||||||
|
miBoletoTemporal.setPuntoVenta(miPuntoVenta);
|
||||||
|
miBoletoTemporal.setRutaId(rutaId);
|
||||||
|
miBoletoTemporal.setTemporeservafidelidade(tempoReserva!=null ? tempoReserva.intValue() : null);
|
||||||
|
miBoletoTemporal.setTipoventaId(unoTipoVenta.byteValue());
|
||||||
|
Usuario usuario = usuarioService.obtenerID(unUsuarioId);
|
||||||
|
miBoletoTemporal.setUsuarioautorizacionId(usuario.getUsuarioUbicacionActivoList().get(0).getUsuarioubicacionId());
|
||||||
|
miBoletoTemporal.setUsuario(usuario);
|
||||||
|
// Cria boleto de reserva
|
||||||
|
suscribir(miBoletoTemporal);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal calcularKmViaje(int rutaId, Integer unoOrigenId, Integer unoDestinoId) {
|
||||||
|
RutaCombinacion rutaCombinacion = rutaCombinacionService.busquedaTramoRutaOrigemDestino(rutaId, unoOrigenId, unoDestinoId);
|
||||||
|
return rutaCombinacion.getTramo().getKmReal();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
String getSequenciaBoletoId(){
|
||||||
|
return boletoDAO.getSequenciaBoletoId();
|
||||||
|
}
|
||||||
|
|
||||||
|
String getSequenciaNumOperacion(){
|
||||||
|
return boletoDAO.getSequenciaNumOperacion();
|
||||||
|
}
|
||||||
|
|
||||||
|
String getSequenciaNumReservacion(){
|
||||||
|
return boletoDAO.getSequenciaNumReservacion();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long formataBoletoId(String boletoSeq){
|
||||||
|
String valor = "1" + String.format("%014d", Integer.valueOf(boletoSeq).intValue());
|
||||||
|
return Long.valueOf(valor);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String formataNumOperacion(String numOperacionSeq){
|
||||||
|
return "01" + (String.format("%010d", Integer.valueOf(numOperacionSeq).intValue()));
|
||||||
|
}
|
||||||
|
|
||||||
|
public String formataNumReservacion(String numReservacopnSeq){
|
||||||
|
return "01" + (String.format("%010d", Integer.valueOf(numReservacopnSeq).intValue()));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,6 +70,19 @@ public class ConstanteServiceImpl implements ConstanteService {
|
||||||
return constanteDAO.buscarPorNomeConstante(nomeConstante);
|
return constanteDAO.buscarPorNomeConstante(nomeConstante);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer buscarValorConstantePorNomeConstante(String nomeConstante){
|
||||||
|
Constante constante = buscarPorNomeConstante(nomeConstante);
|
||||||
|
try {
|
||||||
|
if(constante!=null && StringUtils.isNotEmpty(constante.getValorconstante()) ) {
|
||||||
|
return Integer.valueOf(constante.getValorconstante().trim());
|
||||||
|
}
|
||||||
|
}catch (Exception e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public List<Constante> buscar(String nombconstante) {
|
public List<Constante> buscar(String nombconstante) {
|
||||||
return constanteDAO.buscar(nombconstante);
|
return constanteDAO.buscar(nombconstante);
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@ import com.rjconsultores.ventaboletos.dao.TramoTiempoDAO;
|
||||||
import com.rjconsultores.ventaboletos.entidad.AsientoExclusivo;
|
import com.rjconsultores.ventaboletos.entidad.AsientoExclusivo;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Ciudad;
|
import com.rjconsultores.ventaboletos.entidad.Ciudad;
|
||||||
import com.rjconsultores.ventaboletos.entidad.ClaseServicio;
|
import com.rjconsultores.ventaboletos.entidad.ClaseServicio;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Cliente;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Constante;
|
import com.rjconsultores.ventaboletos.entidad.Constante;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Corrida;
|
import com.rjconsultores.ventaboletos.entidad.Corrida;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Corrida.Id;
|
import com.rjconsultores.ventaboletos.entidad.Corrida.Id;
|
||||||
|
@ -44,15 +45,21 @@ import com.rjconsultores.ventaboletos.entidad.EsquemaCorrida;
|
||||||
import com.rjconsultores.ventaboletos.entidad.EsquemaTramo;
|
import com.rjconsultores.ventaboletos.entidad.EsquemaTramo;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Estado;
|
import com.rjconsultores.ventaboletos.entidad.Estado;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Marca;
|
import com.rjconsultores.ventaboletos.entidad.Marca;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Moneda;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Parada;
|
import com.rjconsultores.ventaboletos.entidad.Parada;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ReservaEspecialCliente;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Ruta;
|
import com.rjconsultores.ventaboletos.entidad.Ruta;
|
||||||
import com.rjconsultores.ventaboletos.entidad.RutaSecuencia;
|
import com.rjconsultores.ventaboletos.entidad.RutaSecuencia;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.Tarifa;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Tramo;
|
import com.rjconsultores.ventaboletos.entidad.Tramo;
|
||||||
import com.rjconsultores.ventaboletos.entidad.TramoServicio;
|
import com.rjconsultores.ventaboletos.entidad.TramoServicio;
|
||||||
import com.rjconsultores.ventaboletos.entidad.TramoTiempo;
|
import com.rjconsultores.ventaboletos.entidad.TramoTiempo;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.VigenciaTarifa;
|
||||||
import com.rjconsultores.ventaboletos.enums.StatusFlexBus;
|
import com.rjconsultores.ventaboletos.enums.StatusFlexBus;
|
||||||
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
import com.rjconsultores.ventaboletos.exception.BusinessException;
|
||||||
import com.rjconsultores.ventaboletos.service.AsientoExclusivoService;
|
import com.rjconsultores.ventaboletos.service.AsientoExclusivoService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.BoletoService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.ClienteService;
|
||||||
import com.rjconsultores.ventaboletos.service.ConstanteService;
|
import com.rjconsultores.ventaboletos.service.ConstanteService;
|
||||||
import com.rjconsultores.ventaboletos.service.CorridaCtrlService;
|
import com.rjconsultores.ventaboletos.service.CorridaCtrlService;
|
||||||
import com.rjconsultores.ventaboletos.service.CorridaService;
|
import com.rjconsultores.ventaboletos.service.CorridaService;
|
||||||
|
@ -60,9 +67,13 @@ import com.rjconsultores.ventaboletos.service.DetDiagramaAutobusService;
|
||||||
import com.rjconsultores.ventaboletos.service.EsquemaAsientoService;
|
import com.rjconsultores.ventaboletos.service.EsquemaAsientoService;
|
||||||
import com.rjconsultores.ventaboletos.service.EsquemaCorridaService;
|
import com.rjconsultores.ventaboletos.service.EsquemaCorridaService;
|
||||||
import com.rjconsultores.ventaboletos.service.EsquemaTramoService;
|
import com.rjconsultores.ventaboletos.service.EsquemaTramoService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.ReservaEspecialClienteService;
|
||||||
import com.rjconsultores.ventaboletos.service.RutaSecuenciaService;
|
import com.rjconsultores.ventaboletos.service.RutaSecuenciaService;
|
||||||
import com.rjconsultores.ventaboletos.service.RutaService;
|
import com.rjconsultores.ventaboletos.service.RutaService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.TarifaService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.TramoService;
|
||||||
import com.rjconsultores.ventaboletos.service.TramoServicioService;
|
import com.rjconsultores.ventaboletos.service.TramoServicioService;
|
||||||
|
import com.rjconsultores.ventaboletos.service.VigenciaTarifaService;
|
||||||
import com.rjconsultores.ventaboletos.utilerias.ActivoUtil;
|
import com.rjconsultores.ventaboletos.utilerias.ActivoUtil;
|
||||||
import com.rjconsultores.ventaboletos.utilerias.DateUtil;
|
import com.rjconsultores.ventaboletos.utilerias.DateUtil;
|
||||||
import com.rjconsultores.ventaboletos.utilerias.FeriadoCache;
|
import com.rjconsultores.ventaboletos.utilerias.FeriadoCache;
|
||||||
|
@ -80,6 +91,8 @@ public class CorridaServiceImpl implements CorridaService {
|
||||||
private static Logger log = Logger.getLogger(CorridaServiceImpl.class);
|
private static Logger log = Logger.getLogger(CorridaServiceImpl.class);
|
||||||
private static int CANT_MAX_CORRIDA_GERA_MANUAL = 40;
|
private static int CANT_MAX_CORRIDA_GERA_MANUAL = 40;
|
||||||
private static SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
|
private static SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");
|
||||||
|
// Tipo de venda Reserva
|
||||||
|
private static final Integer TPV_RESERVA_NORMAL = 15;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private CorridaDAO corridaDAO;
|
private CorridaDAO corridaDAO;
|
||||||
|
@ -114,6 +127,19 @@ public class CorridaServiceImpl implements CorridaService {
|
||||||
private int cantCorridaCommit;
|
private int cantCorridaCommit;
|
||||||
@Autowired
|
@Autowired
|
||||||
private FeriadoCache feriadoCache;
|
private FeriadoCache feriadoCache;
|
||||||
|
@Autowired
|
||||||
|
private BoletoService boletoService;
|
||||||
|
@Autowired
|
||||||
|
private ReservaEspecialClienteService reservaEspecialClientService;
|
||||||
|
@Autowired
|
||||||
|
private TarifaService tarifaService;
|
||||||
|
@Autowired
|
||||||
|
TramoService tramoService;
|
||||||
|
@Autowired
|
||||||
|
VigenciaTarifaService vigenciaTarifaService;
|
||||||
|
@Autowired
|
||||||
|
ClienteService clienteService;
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
public CorridaServiceImpl(@Qualifier("transactionManager") PlatformTransactionManager transactionManager) {
|
public CorridaServiceImpl(@Qualifier("transactionManager") PlatformTransactionManager transactionManager) {
|
||||||
|
@ -837,6 +863,10 @@ public class CorridaServiceImpl implements CorridaService {
|
||||||
cantCorridaCommit = 1;
|
cantCorridaCommit = 1;
|
||||||
java.sql.Date data = new java.sql.Date(dataGeracao.getTime());
|
java.sql.Date data = new java.sql.Date(dataGeracao.getTime());
|
||||||
|
|
||||||
|
Integer unUsuarioId = constanteService.buscarValorConstantePorNomeConstante("USUARIO_RESERVA_CLIENTES");
|
||||||
|
Integer unPuntoVenta= constanteService.buscarValorConstantePorNomeConstante("PUNTOVENTA_RESERVA_CLIENTES");
|
||||||
|
Integer estacionId = constanteService.buscarValorConstantePorNomeConstante("ESTACION_RESERVA_CLIENTES");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
for (EsquemaCorrida esquemaCorrida : lsEsquemaCorrida) {
|
for (EsquemaCorrida esquemaCorrida : lsEsquemaCorrida) {
|
||||||
|
@ -983,6 +1013,12 @@ public class CorridaServiceImpl implements CorridaService {
|
||||||
transactionManager.commit(status);
|
transactionManager.commit(status);
|
||||||
status = transactionManager.getTransaction(def);
|
status = transactionManager.getTransaction(def);
|
||||||
}
|
}
|
||||||
|
//Valida se existe configuração de reserva para o cliente e crria Cria reserva
|
||||||
|
if(corrida !=null) {
|
||||||
|
if(unUsuarioId!=null && unPuntoVenta!=null && estacionId!=null) {
|
||||||
|
validaCriaReservaCliente(corrida, unUsuarioId, unPuntoVenta, estacionId);
|
||||||
|
}
|
||||||
|
}
|
||||||
} // for (EsquemaCorrida esquemaCorrida : lsEsquemaCorrida)
|
} // for (EsquemaCorrida esquemaCorrida : lsEsquemaCorrida)
|
||||||
} finally {
|
} finally {
|
||||||
if ((status != null) && (!status.isCompleted())) {
|
if ((status != null) && (!status.isCompleted())) {
|
||||||
|
@ -991,6 +1027,58 @@ public class CorridaServiceImpl implements CorridaService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void validaCriaReservaCliente(Corrida corrida, Integer unUsuarioId, Integer unPuntoVenta, Integer estacionId) {
|
||||||
|
try {
|
||||||
|
List<ReservaEspecialCliente> reservaEspecialClienteList = reservaEspecialClientService.bucarReservaEspecialByCorridaId(corrida.getId().getCorridaId().longValue()) ;
|
||||||
|
if(reservaEspecialClienteList !=null) {
|
||||||
|
for (ReservaEspecialCliente reservaEspecialCliente : reservaEspecialClienteList) {
|
||||||
|
Integer unoTerminalOrigenId = reservaEspecialCliente.getOrigem().getParadaId();
|
||||||
|
Integer unoTerminalDestinoId = reservaEspecialCliente.getDestino().getParadaId();
|
||||||
|
String unoAsientoSelec = reservaEspecialCliente.getNumAsentoCorrida().toString();
|
||||||
|
Integer unaCorridaId =corrida.getId().getCorridaId().intValue();
|
||||||
|
Date unaFecCorrida= corrida.getId().getFeccorrida();
|
||||||
|
Integer unoTipoVenta= TPV_RESERVA_NORMAL;
|
||||||
|
Integer unaCategoriaSelec= 1 ;
|
||||||
|
String unoNumeOperacion= null ;
|
||||||
|
Tramo tramo = null;
|
||||||
|
Date fecViaje = corrida.getFechorsalida();
|
||||||
|
for (CorridaTramo corridaTramo : corrida.getCorridaTramoList()) {
|
||||||
|
if(corridaTramo.getOrigem()!=null && corridaTramo.getOrigem().getParadaId().intValue()==unoTerminalOrigenId.intValue()
|
||||||
|
&& corridaTramo.getDestino()!=null && corridaTramo.getDestino().getParadaId().intValue()==unoTerminalDestinoId.intValue())
|
||||||
|
tramo = corridaTramo.getTramo();
|
||||||
|
fecViaje = corridaTramo.getFechorsalidaH();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(tramo==null) {
|
||||||
|
log.error("Reserva não será realizada. Não foi encontrado trecho com Origem:" + unoTerminalOrigenId + " Destino:" +unoTerminalDestinoId + " para a corrida:" + corrida.getId().getCorridaId());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
List<VigenciaTarifa> vigenciaTarifaList = vigenciaTarifaService.buscarVigenciasIntervalo(new VigenciaTarifa(corrida.getFechorSalidaOriginal(), corrida.getFechorSalidaOriginal()));
|
||||||
|
if(vigenciaTarifaList==null || vigenciaTarifaList.isEmpty()) {
|
||||||
|
log.error("Reserva não será realizada. Não foi encontrado Vigência Tarifa com Origem:" + unoTerminalOrigenId + " Destino:" +unoTerminalDestinoId + " para a corrida:" + corrida.getId().getCorridaId());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
Tarifa tarifa = tarifaService.buscar(tramo, corrida.getMarca(), corrida.getClaseServicio(), vigenciaTarifaList!=null ? vigenciaTarifaList.get(0) : null, new Moneda(1), corrida.getRuta());
|
||||||
|
if(tarifa==null ) {
|
||||||
|
log.error("Reserva não será realizada. Não foi encontrado Tarifa com Origem:" + unoTerminalOrigenId + " Destino:" +unoTerminalDestinoId + " para a corrida:" + corrida.getId().getCorridaId());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
Float valorTarifa= tarifa!=null ? tarifa.getPrecio().floatValue() : null ;
|
||||||
|
//Long tempoReserva = reservaEspecialCliente.getTempoConfirmacao().getTime();
|
||||||
|
Long tempoReserva = null;
|
||||||
|
Cliente cliente = clienteService.obtenerID(reservaEspecialCliente.getClienteId().intValue());
|
||||||
|
boletoService.criaBoletoReserva(unoAsientoSelec, unaCorridaId, unaFecCorrida, unoTerminalOrigenId,
|
||||||
|
unoTerminalDestinoId, unoTipoVenta, unaCategoriaSelec, unoNumeOperacion, unUsuarioId, unPuntoVenta,
|
||||||
|
reservaEspecialCliente.getClienteId().intValue(), corrida.getRuta().getRutaId(), valorTarifa, tempoReserva,
|
||||||
|
estacionId, cliente.getNumIdentificaUno(), cliente.getListClienteFidelidad().get(0).getClienteFidelidadId().toString(),
|
||||||
|
corrida.getClaseServicio().getClaseservicioId(), corrida.getMarca().getMarcaId(), fecViaje, corrida.getEmpresa().getEmpresaId(), cliente.getNombcliente());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("Erro ao validar/criar reserva especial de clientes", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void alterarNumPisoCorridaPisoExtra(Corrida corrida, Corrida corridaPisoExtra, String mensagemLog, Boolean atualizarPisoExtra, boolean isPiso3) {
|
private void alterarNumPisoCorridaPisoExtra(Corrida corrida, Corrida corridaPisoExtra, String mensagemLog, Boolean atualizarPisoExtra, boolean isPiso3) {
|
||||||
if (corrida != null && corridaPisoExtra != null) {
|
if (corrida != null && corridaPisoExtra != null) {
|
||||||
log.info(mensagemLog + "; atualizando as corridas do piso 1 e 2");
|
log.info(mensagemLog + "; atualizando as corridas do piso 1 e 2");
|
||||||
|
|
|
@ -0,0 +1,78 @@
|
||||||
|
/*
|
||||||
|
* 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.ReservaEspecialClienteDAO;
|
||||||
|
import com.rjconsultores.ventaboletos.entidad.ReservaEspecialCliente;
|
||||||
|
import com.rjconsultores.ventaboletos.service.ReservaEspecialClienteService;
|
||||||
|
import com.rjconsultores.ventaboletos.utilerias.UsuarioLogado;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author valde
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Service("reservaEspecialClienteService")
|
||||||
|
public class ReservaEspecialClienteServiceImpl implements ReservaEspecialClienteService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ReservaEspecialClienteDAO reservaEspecialClienteDAO;
|
||||||
|
|
||||||
|
public List<ReservaEspecialCliente> obtenerTodos() {
|
||||||
|
return reservaEspecialClienteDAO.obtenerTodos();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ReservaEspecialCliente obtenerID(Integer id) {
|
||||||
|
return reservaEspecialClienteDAO.obtenerID(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public ReservaEspecialCliente suscribir(ReservaEspecialCliente entidad) {
|
||||||
|
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
entidad.setActivo(Boolean.TRUE);
|
||||||
|
|
||||||
|
return reservaEspecialClienteDAO.suscribir(entidad);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public ReservaEspecialCliente actualizacion(ReservaEspecialCliente entidad) {
|
||||||
|
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
entidad.setActivo(Boolean.TRUE);
|
||||||
|
|
||||||
|
return reservaEspecialClienteDAO.actualizacion(entidad);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
public void borrar(ReservaEspecialCliente entidad) {
|
||||||
|
entidad.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
|
||||||
|
entidad.setFecmodif(Calendar.getInstance().getTime());
|
||||||
|
entidad.setActivo(Boolean.FALSE);
|
||||||
|
|
||||||
|
reservaEspecialClienteDAO.actualizacion(entidad);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ReservaEspecialCliente> bucarReservaEspecialByClienteId(Long clienteId) {
|
||||||
|
return reservaEspecialClienteDAO.bucarReservaEspecialByClienteId(clienteId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ReservaEspecialCliente> bucarReservaEspecialByCorridaId(Long corridaId) {
|
||||||
|
return reservaEspecialClienteDAO.bucarReservaEspecialByCorridaId(corridaId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue