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;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
import com.rjconsultores.ventaboletos.entidad.Boleto;
|
||||
|
@ -18,6 +19,10 @@ public interface BoletoService {
|
|||
|
||||
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.dao.BoletoDAO;
|
||||
import com.rjconsultores.ventaboletos.entidad.Boleto;
|
||||
import com.rjconsultores.ventaboletos.entidad.PtoVtaSeguro;
|
||||
import com.rjconsultores.ventaboletos.entidad.PuntoVenta;
|
||||
import com.rjconsultores.ventaboletos.entidad.RutaCombinacion;
|
||||
import com.rjconsultores.ventaboletos.entidad.Usuario;
|
||||
|
@ -58,15 +59,14 @@ public class BoletoServiceImpl implements BoletoService {
|
|||
@Transactional
|
||||
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 {
|
||||
String unoNumeOperacion, Integer unUsuarioId, Integer unPuntoVenta, Integer unClienteId, Integer rutaId,
|
||||
BigDecimal tarifa, Long tempoReserva, Integer estacionId, String docCPF, String numFidelidade, Integer claseservicioId,
|
||||
Short marcaId, Date fecViaje, Integer empresaCorridaId, String nombPassageiro, BigDecimal valorSeguro,
|
||||
BigDecimal valorTaxaEmbarque, BigDecimal valorPedagio) throws Exception {
|
||||
|
||||
PuntoVenta miPuntoVenta = puntoVentaService.obtenerID(unPuntoVenta.intValue());
|
||||
|
||||
Boleto miBoletoTemporal = new Boleto();
|
||||
BigDecimal miPrecio = MoneyHelper.arredondar(tarifa) ;
|
||||
miBoletoTemporal = new Boleto();
|
||||
atualizaValoresTarifaPedagioSeguroTaxaEmbarque(tarifa, empresaCorridaId, valorSeguro, valorTaxaEmbarque, valorPedagio, miPuntoVenta, miBoletoTemporal);
|
||||
miBoletoTemporal.setBoletoId(formataBoletoId(getSequenciaBoletoId()));
|
||||
miBoletoTemporal.setBoletooriginalId(miBoletoTemporal.getBoletoId());
|
||||
// Sempre Categoria Normal (1)
|
||||
|
@ -111,8 +111,6 @@ public class BoletoServiceImpl implements BoletoService {
|
|||
miBoletoTemporal.setOrigenId(unoTerminalOrigenId);
|
||||
miBoletoTemporal.setPreciopricing(BigDecimal.ZERO);
|
||||
miBoletoTemporal.setPorccategoria(null);
|
||||
miBoletoTemporal.setPreciopagado(miPrecio);
|
||||
miBoletoTemporal.setPreciobase(miPrecio);
|
||||
miBoletoTemporal.setPuntoVenta(miPuntoVenta);
|
||||
miBoletoTemporal.setPtovtaventaId(miPuntoVenta.getPuntoventaId());
|
||||
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) {
|
||||
RutaCombinacion rutaCombinacion = rutaCombinacionService.busquedaTramoRutaOrigemDestino(rutaId, unoOrigenId, unoDestinoId);
|
||||
return rutaCombinacion.getTramo().getKmReal();
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
*/
|
||||
package com.rjconsultores.ventaboletos.service.impl;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
|
@ -1060,7 +1061,7 @@ public class CorridaServiceImpl implements CorridaService {
|
|||
|
||||
for (CorridaTramo corridaTramo : corrida.getCorridaTramoList()) {
|
||||
//(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()
|
||||
&& corridaTramo.getDestino()!=null && corridaTramo.getDestino().getParadaId().intValue()==unoTerminalDestinoId.intValue()) {
|
||||
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());
|
||||
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;
|
||||
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());
|
||||
corrida.getClaseServicio().getClaseservicioId(), corrida.getMarca().getMarcaId(), fecViaje, corrida.getEmpresa().getEmpresaId(),
|
||||
cliente.getNombcliente(), valorSeguro, valorTaxaEmbarque, valorPedagio);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue