fixes bug#24096
qua: dev:Aristides git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@110937 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
09505c802f
commit
3a69c869a6
|
@ -4,6 +4,7 @@
|
||||||
*/
|
*/
|
||||||
package com.rjconsultores.ventaboletos.service;
|
package com.rjconsultores.ventaboletos.service;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import com.rjconsultores.ventaboletos.entidad.Boleto;
|
import com.rjconsultores.ventaboletos.entidad.Boleto;
|
||||||
|
@ -18,6 +19,10 @@ public interface BoletoService {
|
||||||
|
|
||||||
public Boleto suscribir(Boleto boleto);
|
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;
|
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, BigDecimal tarifa, Long tempoReserva, Integer estacionId, String cpf,
|
||||||
|
String numFidelidade, Integer claseservicioId, Short marcaId, Date fecViaje, Integer empresaCorridaId, String nombPassageiro,
|
||||||
|
BigDecimal valorSeguro, BigDecimal valorTaxaEmbarque, BigDecimal valorPedagio) throws Exception;
|
||||||
|
|
||||||
}
|
}
|
|
@ -14,6 +14,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
import com.rjconsultores.ventaboletos.constantes.Constantes;
|
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.PtoVtaSeguro;
|
||||||
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
||||||
import com.rjconsultores.ventaboletos.entidad.RutaCombinacion;
|
import com.rjconsultores.ventaboletos.entidad.RutaCombinacion;
|
||||||
import com.rjconsultores.ventaboletos.entidad.Usuario;
|
import com.rjconsultores.ventaboletos.entidad.Usuario;
|
||||||
|
@ -58,15 +59,14 @@ public class BoletoServiceImpl implements BoletoService {
|
||||||
@Transactional
|
@Transactional
|
||||||
public void criaBoletoReserva(String unoAsientoSelec, Integer unaCorridaId, Date unaFecCorrida,
|
public void criaBoletoReserva(String unoAsientoSelec, Integer unaCorridaId, Date unaFecCorrida,
|
||||||
Integer unoTerminalOrigenId, Integer unoTerminalDestinoId, Integer unoTipoVenta, Integer unaCategoriaSelec,
|
Integer unoTerminalOrigenId, Integer unoTerminalDestinoId, Integer unoTipoVenta, Integer unaCategoriaSelec,
|
||||||
String unoNumeOperacion, Integer unUsuarioId, Integer unPuntoVenta,
|
String unoNumeOperacion, Integer unUsuarioId, Integer unPuntoVenta, Integer unClienteId, Integer rutaId,
|
||||||
Integer unClienteId, Integer rutaId, Float tarifa, Long tempoReserva,
|
BigDecimal tarifa, Long tempoReserva, Integer estacionId, String docCPF, String numFidelidade, Integer claseservicioId,
|
||||||
Integer estacionId, String docCPF, String numFidelidade, Integer claseservicioId, Short marcaId, Date fecViaje, Integer empresaCorridaId, String nombPassageiro) throws Exception {
|
Short marcaId, Date fecViaje, Integer empresaCorridaId, String nombPassageiro, BigDecimal valorSeguro,
|
||||||
|
BigDecimal valorTaxaEmbarque, BigDecimal valorPedagio) throws Exception {
|
||||||
|
|
||||||
PuntoVenta miPuntoVenta = puntoVentaService.obtenerID(unPuntoVenta.intValue());
|
PuntoVenta miPuntoVenta = puntoVentaService.obtenerID(unPuntoVenta.intValue());
|
||||||
|
|
||||||
Boleto miBoletoTemporal = new Boleto();
|
Boleto miBoletoTemporal = new Boleto();
|
||||||
BigDecimal miPrecio = MoneyHelper.arredondar(tarifa) ;
|
atualizaValoresTarifaPedagioSeguroTaxaEmbarque(tarifa, empresaCorridaId, valorSeguro, valorTaxaEmbarque, valorPedagio, miPuntoVenta, miBoletoTemporal);
|
||||||
miBoletoTemporal = new Boleto();
|
|
||||||
miBoletoTemporal.setBoletoId(formataBoletoId(getSequenciaBoletoId()));
|
miBoletoTemporal.setBoletoId(formataBoletoId(getSequenciaBoletoId()));
|
||||||
miBoletoTemporal.setBoletooriginalId(miBoletoTemporal.getBoletoId());
|
miBoletoTemporal.setBoletooriginalId(miBoletoTemporal.getBoletoId());
|
||||||
// Sempre Categoria Normal (1)
|
// Sempre Categoria Normal (1)
|
||||||
|
@ -111,8 +111,6 @@ public class BoletoServiceImpl implements BoletoService {
|
||||||
miBoletoTemporal.setOrigenId(unoTerminalOrigenId);
|
miBoletoTemporal.setOrigenId(unoTerminalOrigenId);
|
||||||
miBoletoTemporal.setPreciopricing(BigDecimal.ZERO);
|
miBoletoTemporal.setPreciopricing(BigDecimal.ZERO);
|
||||||
miBoletoTemporal.setPorccategoria(null);
|
miBoletoTemporal.setPorccategoria(null);
|
||||||
miBoletoTemporal.setPreciopagado(miPrecio);
|
|
||||||
miBoletoTemporal.setPreciobase(miPrecio);
|
|
||||||
miBoletoTemporal.setPuntoVenta(miPuntoVenta);
|
miBoletoTemporal.setPuntoVenta(miPuntoVenta);
|
||||||
miBoletoTemporal.setPtovtaventaId(miPuntoVenta.getPuntoventaId());
|
miBoletoTemporal.setPtovtaventaId(miPuntoVenta.getPuntoventaId());
|
||||||
miBoletoTemporal.setRutaId(rutaId);
|
miBoletoTemporal.setRutaId(rutaId);
|
||||||
|
@ -127,6 +125,39 @@ public class BoletoServiceImpl implements BoletoService {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verifica e atualiza valores tarifa, pedágio, seguro e taxa de embarque.
|
||||||
|
* Sendo que o seguro e taxa de embarque somente serão setados caso no ponto de venda marcado como vende default.
|
||||||
|
* @param tarifa
|
||||||
|
* @param empresaCorridaId
|
||||||
|
* @param valorSeguro
|
||||||
|
* @param valorTaxaEmbarque
|
||||||
|
* @param valorPedagio
|
||||||
|
* @param miPuntoVenta
|
||||||
|
* @param miBoletoTemporal
|
||||||
|
*/
|
||||||
|
private void atualizaValoresTarifaPedagioSeguroTaxaEmbarque(BigDecimal tarifa, Integer empresaCorridaId, BigDecimal valorSeguro,
|
||||||
|
BigDecimal valorTaxaEmbarque, BigDecimal valorPedagio, PuntoVenta miPuntoVenta, Boleto miBoletoTemporal) {
|
||||||
|
BigDecimal miPrecio = MoneyHelper.arredondar(tarifa) ;
|
||||||
|
miBoletoTemporal.setImportepedagio(valorPedagio);
|
||||||
|
miBoletoTemporal.setPreciopagado(miPrecio);
|
||||||
|
miBoletoTemporal.setPreciobase(miPrecio);
|
||||||
|
if(miPuntoVenta !=null && miPuntoVenta.getPtovtaSeguroList() !=null) {
|
||||||
|
for (PtoVtaSeguro ptoVtaSeguro : miPuntoVenta.getPtovtaSeguroList()) {
|
||||||
|
if(empresaCorridaId.equals(ptoVtaSeguro.getEmpresa().getEmpresaId()) && Boolean.TRUE.equals(miPuntoVenta.getActivo())) {
|
||||||
|
if(Boolean.TRUE.equals(ptoVtaSeguro.getIndEstanTasaEmbarque())) {
|
||||||
|
miBoletoTemporal.setImportetaxaembarque(valorTaxaEmbarque);
|
||||||
|
}
|
||||||
|
if(Boolean.TRUE.equals(ptoVtaSeguro.getIndEstanSegTabela())) {
|
||||||
|
miBoletoTemporal.setImporteseguro(valorSeguro);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public BigDecimal calcularKmViaje(int rutaId, Integer unoOrigenId, Integer unoDestinoId) {
|
public BigDecimal calcularKmViaje(int rutaId, Integer unoOrigenId, Integer unoDestinoId) {
|
||||||
RutaCombinacion rutaCombinacion = rutaCombinacionService.busquedaTramoRutaOrigemDestino(rutaId, unoOrigenId, unoDestinoId);
|
RutaCombinacion rutaCombinacion = rutaCombinacionService.busquedaTramoRutaOrigemDestino(rutaId, unoOrigenId, unoDestinoId);
|
||||||
return rutaCombinacion.getTramo().getKmReal();
|
return rutaCombinacion.getTramo().getKmReal();
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
*/
|
*/
|
||||||
package com.rjconsultores.ventaboletos.service.impl;
|
package com.rjconsultores.ventaboletos.service.impl;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
@ -1060,7 +1061,7 @@ public class CorridaServiceImpl implements CorridaService {
|
||||||
|
|
||||||
for (CorridaTramo corridaTramo : corrida.getCorridaTramoList()) {
|
for (CorridaTramo corridaTramo : corrida.getCorridaTramoList()) {
|
||||||
//(Se origem corridatramo = origem cadastrada && destino corridatramo = destino cadastrado)
|
//(Se origem corridatramo = origem cadastrada && destino corridatramo = destino cadastrado)
|
||||||
// ou (se origem corridatramo = destino do cadastrado), tendo em vista que corridatramo são a sequencias e não as combinações
|
// ou (se origem corridatramo = destino do cadastrado), tendo em vista que corridatramo são as sequencias e não as combinações
|
||||||
if(corridaTramo.getOrigem()!=null && corridaTramo.getOrigem().getParadaId().intValue()==unoTerminalOrigenId.intValue()
|
if(corridaTramo.getOrigem()!=null && corridaTramo.getOrigem().getParadaId().intValue()==unoTerminalOrigenId.intValue()
|
||||||
&& corridaTramo.getDestino()!=null && corridaTramo.getDestino().getParadaId().intValue()==unoTerminalDestinoId.intValue()) {
|
&& corridaTramo.getDestino()!=null && corridaTramo.getDestino().getParadaId().intValue()==unoTerminalDestinoId.intValue()) {
|
||||||
fecViaje = corridaTramo.getFechorsalidaH();
|
fecViaje = corridaTramo.getFechorsalidaH();
|
||||||
|
@ -1082,14 +1083,18 @@ public class CorridaServiceImpl implements CorridaService {
|
||||||
log.error("Reserva não será realizada. Não foi encontrado Tarifa com Origem:" + unoTerminalOrigenId + " Destino:" +unoTerminalDestinoId + " para a corrida:" + corrida.getId().getCorridaId());
|
log.error("Reserva não será realizada. Não foi encontrado Tarifa com Origem:" + unoTerminalOrigenId + " Destino:" +unoTerminalDestinoId + " para a corrida:" + corrida.getId().getCorridaId());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Float valorTarifa= tarifa!=null ? tarifa.getPrecio().floatValue() : null ;
|
BigDecimal valorTarifa= tarifa!=null ? tarifa.getPrecio() : null ;
|
||||||
|
BigDecimal valorSeguro= tarifa!=null ? tarifa.getImporteseguro() : null ;
|
||||||
|
BigDecimal valorTaxaEmbarque= tarifa!=null ? tarifa.getImportetaxaembarque() : null ;
|
||||||
|
BigDecimal valorPedagio = tarifa!=null ? tarifa.getImportepedagio() : null ;
|
||||||
Long tempoReserva = null;
|
Long tempoReserva = null;
|
||||||
Cliente cliente = clienteService.obtenerID(reservaEspecialCliente.getClienteId().intValue());
|
Cliente cliente = clienteService.obtenerID(reservaEspecialCliente.getClienteId().intValue());
|
||||||
boletoService.criaBoletoReserva(unoAsientoSelec, unaCorridaId, unaFecCorrida, unoTerminalOrigenId,
|
boletoService.criaBoletoReserva(unoAsientoSelec, unaCorridaId, unaFecCorrida, unoTerminalOrigenId,
|
||||||
unoTerminalDestinoId, unoTipoVenta, unaCategoriaSelec, unoNumeOperacion, unUsuarioId, unPuntoVenta,
|
unoTerminalDestinoId, unoTipoVenta, unaCategoriaSelec, unoNumeOperacion, unUsuarioId, unPuntoVenta,
|
||||||
reservaEspecialCliente.getClienteId().intValue(), corrida.getRuta().getRutaId(), valorTarifa, tempoReserva,
|
reservaEspecialCliente.getClienteId().intValue(), corrida.getRuta().getRutaId(), valorTarifa, tempoReserva,
|
||||||
estacionId, cliente.getNumIdentificaUno(), cliente.getListClienteFidelidad().get(0).getClienteFidelidadId().toString(),
|
estacionId, cliente.getNumIdentificaUno(), cliente.getListClienteFidelidad().get(0).getClienteFidelidadId().toString(),
|
||||||
corrida.getClaseServicio().getClaseservicioId(), corrida.getMarca().getMarcaId(), fecViaje, corrida.getEmpresa().getEmpresaId(), cliente.getNombcliente());
|
corrida.getClaseServicio().getClaseservicioId(), corrida.getMarca().getMarcaId(), fecViaje, corrida.getEmpresa().getEmpresaId(),
|
||||||
|
cliente.getNombcliente(), valorSeguro, valorTaxaEmbarque, valorPedagio);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue