From 92016c8cd1e8559fe3165b7806a77f5cc314c422 Mon Sep 17 00:00:00 2001 From: wilian Date: Fri, 29 Apr 2016 21:32:53 +0000 Subject: [PATCH] fixes bug #7406 git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@55432 d1611594-4594-4d17-8e1d-87c2c4800839 --- .../ventaboletos/constantes/Constantes.java | 2 + .../ConferenciaComissaoHibernateDAO.java | 40 +-- .../service/ConferenciaComissaoService.java | 3 +- .../impl/ConferenciaComissaoServiceImpl.java | 282 +++++++---------- .../vo/comissao/BoletoComissao.java | 286 ++++++++++++++++-- 5 files changed, 393 insertions(+), 220 deletions(-) diff --git a/src/com/rjconsultores/ventaboletos/constantes/Constantes.java b/src/com/rjconsultores/ventaboletos/constantes/Constantes.java index 3635d2597..f21917a27 100644 --- a/src/com/rjconsultores/ventaboletos/constantes/Constantes.java +++ b/src/com/rjconsultores/ventaboletos/constantes/Constantes.java @@ -22,11 +22,13 @@ public class Constantes { public static Long TPV_DIRECTO_NORMAL = new Long(1); public static Long TPV_MANUAL = new Long(3); + public static Long TPV_CALL_CENTER = new Long(5); public static Long TPV_BOLETO_REMOTO = new Long(18); public static Long TPV_TRANSFERENCIAS = new Long(8); // é a troca de passagens public static Long TPV_CAMBIO_VIAJE = new Long(81); // é a transferência de passagens public static Long TPV_CHECKIN_VIAGEM = new Long(41); // chekin boletos public static Long TPV_BOLETO_ABIERTO = new Long(9); + public static Long TPV_CONFIRMA_ABIERTO = new Long(82); public static Long TPV_RESERVACION_POR_INTERNET = new Long(16); public static Long TPV_POR_INTERNET = new Long(12); diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/ConferenciaComissaoHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConferenciaComissaoHibernateDAO.java index 4b0ac1d4b..5e2b1eb73 100644 --- a/src/com/rjconsultores/ventaboletos/dao/hibernate/ConferenciaComissaoHibernateDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/ConferenciaComissaoHibernateDAO.java @@ -173,26 +173,10 @@ public class ConferenciaComissaoHibernateDAO extends GenericHibernateDAO lsBoletoComissao) throws BusinessException; + public BigDecimal totalizarBoletoComissao(List lsBoletoComissao, IndStatusBoleto... statusBilhete) throws BusinessException; public BigDecimal totalizarEventosFinanceiros(List lsEventosFinanceiros) throws BusinessException; diff --git a/src/com/rjconsultores/ventaboletos/service/impl/ConferenciaComissaoServiceImpl.java b/src/com/rjconsultores/ventaboletos/service/impl/ConferenciaComissaoServiceImpl.java index 9480d4d72..502652e54 100644 --- a/src/com/rjconsultores/ventaboletos/service/impl/ConferenciaComissaoServiceImpl.java +++ b/src/com/rjconsultores/ventaboletos/service/impl/ConferenciaComissaoServiceImpl.java @@ -2,13 +2,15 @@ package com.rjconsultores.ventaboletos.service.impl; import java.math.BigDecimal; import java.util.ArrayList; +import java.util.Arrays; import java.util.Calendar; import java.util.Date; import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Set; -import org.apache.commons.lang.StringUtils; import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -150,92 +152,124 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic return boletoComissaos; } + List retorno = new ArrayList(); switch (boletoStatusComissao) { case BOLETOS_VENDIDOS: - return carregarBilhetesVendidos(boletoComissaos); + retorno.addAll(carregarBilhetesVendidos(boletoComissaos)); + break; case BOLETO_MANUAL: - return carregarBilhetesManuais(boletoComissaos); + retorno.addAll(carregarBilhetesManuais(boletoComissaos)); + break; case BOLETO_CANCELADO: - return carregarBilhetesCancelados(boletoComissaos); + retorno.addAll(carregarBilhetesCancelados(boletoComissaos)); + break; case BOLETO_DEVOLVIDO: - return carregarBilhetesDevolvidos(boletoComissaos); + retorno.addAll(carregarBilhetesDevolvidos(boletoComissaos)); + break; case GAP_VENDIDOS: - return carregarBilhetesGapsVendidos(boletoComissaos); + retorno.addAll(carregarBilhetesGapsVendidos(boletoComissaos)); + break; case GAP_CANCELADO: - return carregarBilhetesGapCancelados(boletoComissaos); + retorno.addAll(carregarBilhetesGapCancelados(boletoComissaos)); + break; case GAP_DEVOLVIDO: - return carregarBilhetesGapDevolvidos(boletoComissaos); + retorno.addAll(carregarBilhetesGapDevolvidos(boletoComissaos)); + break; default: break; } - return new ArrayList(); + return retorno; } - private List carregarBilhetesVendidos(List boletoComissaos) { - List boletos = new ArrayList(); + private Set carregarBilhetesManuais(List boletoComissaos) { + Set boletos = new HashSet(); for (BoletoComissao boletoComissao : boletoComissaos) { - if(isBilhetesNormalVendido(boletoComissao) || isBilhetesImpresso(boletoComissao) || isBilhetesNormalTranferido(boletoComissao)) { + if(boletoComissao.isBilhetesManualVendido()) { + boletos.add(boletoComissao); + } + } + return boletos; + } + + private Set carregarBilhetesVendidos(List boletoComissaos) { + Set boletos = new HashSet(); + for (BoletoComissao boletoComissao : boletoComissaos) { + if(boletoComissao.isBilheteNormalVendido() || + boletoComissao.isBilheteEntregaGap() || + boletoComissao.isBilheteNormalChekin() || + boletoComissao.isBilheteAberto() || + boletoComissao.isBilheteEntregaAberto()) { + + boletos.add(boletoComissao); + + } + } + return boletos; + } + + private Set carregarBilhetesCancelados(List boletoComissaos) { + Set boletos = new HashSet(); + for (BoletoComissao boletoComissao : boletoComissaos) { + if(boletoComissao.isBilheteNormalCancelado() || + boletoComissao.isBilheteNormalTrocadoCancelado() || + boletoComissao.isBilheteAbertoCancelado() || + boletoComissao.isBilheteEntregaGapCancelado()) { + + boletos.add(boletoComissao); + + } + } + return boletos; + } + + private Set carregarBilhetesDevolvidos(List boletoComissaos) { + Set boletos = new HashSet(); + for (BoletoComissao boletoComissao : boletoComissaos) { + if(boletoComissao.isBilheteNormalDevolvido() || + boletoComissao.isBilheteNormalTrocado() || + boletoComissao.isBilheteNormalTrocadoDevolvido() || + boletoComissao.isBilheteNormalTransferidoDevolvido() || + boletoComissao.isBilheteAbertoDevolvido() || + boletoComissao.isBilheteEntregaGapDevolvido() || + boletoComissao.isBilheteEntregaGapTrocado()) { + + boletos.add(boletoComissao); + + } + } + return boletos; + } + + private Set carregarBilhetesGapsVendidos(List boletoComissaos) { + Set boletos = new HashSet(); + for (BoletoComissao boletoComissao : boletoComissaos) { + if(boletoComissao.isBilheteGapVendido()) { + + boletos.add(boletoComissao); + + } + } + return boletos; + } + + private Set carregarBilhetesGapCancelados(List boletoComissaos) { + Set boletos = new HashSet(); + for (BoletoComissao boletoComissao : boletoComissaos) { + if(boletoComissao.isBilheteGapCancelado()) { boletos.add(boletoComissao); } } return boletos; } - private List carregarBilhetesManuais(List boletoComissaos) { - List boletos = new ArrayList(); + private Set carregarBilhetesGapDevolvidos(List boletoComissaos) { + Set boletos = new HashSet(); for (BoletoComissao boletoComissao : boletoComissaos) { - if(isBilhetesManualVendido(boletoComissao)) { - boletos.add(boletoComissao); - } - } - return boletos; - } - - private List carregarBilhetesCancelados(List boletoComissaos) { - List boletos = new ArrayList(); - for (BoletoComissao boletoComissao : boletoComissaos) { - if(isBilhetesNormalCancelado(boletoComissao)) { - boletos.add(boletoComissao); - } - } - return boletos; - } - - private List carregarBilhetesDevolvidos(List boletoComissaos) { - List boletos = new ArrayList(); - for (BoletoComissao boletoComissao : boletoComissaos) { - if(isBilhetesNormalDevolvido(boletoComissao)|| isBilhetesNormalTrocado(boletoComissao) ) { - boletos.add(boletoComissao); - } - } - return boletos; - } - - private List carregarBilhetesGapsVendidos(List boletoComissaos) { - List boletos = new ArrayList(); - for (BoletoComissao boletoComissao : boletoComissaos) { - if(isBilhetesGapVendido(boletoComissao) || isBilhetesGapTransferido(boletoComissao)) { - boletos.add(boletoComissao); - } - } - return boletos; - } - - private List carregarBilhetesGapCancelados(List boletoComissaos) { - List boletos = new ArrayList(); - for (BoletoComissao boletoComissao : boletoComissaos) { - if(isBilhetesGapCancelado(boletoComissao)) { - boletos.add(boletoComissao); - } - } - return boletos; - } - - private List carregarBilhetesGapDevolvidos(List boletoComissaos) { - List boletos = new ArrayList(); - for (BoletoComissao boletoComissao : boletoComissaos) { - if(isBilhetesGapDevolvido(boletoComissao) || isBilhetesGapTrocado(boletoComissao)) { + if(boletoComissao.isBilheteGapDevolvido() || + boletoComissao.isBilheteGapTrocado()) { + boletos.add(boletoComissao); + } } return boletos; @@ -269,11 +303,18 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic } @Override - public BigDecimal totalizarBoletoComissao(List lsBoletoComissao) throws BusinessException { + public BigDecimal totalizarBoletoComissao(List lsBoletoComissao, IndStatusBoleto... statusBilhete) throws BusinessException { + List lStatusBilhete = null; + if(statusBilhete != null && statusBilhete.length > 0) { + lStatusBilhete = Arrays.asList(statusBilhete); + } + BigDecimal total = BigDecimal.ZERO; if(lsBoletoComissao != null) { for (BoletoComissao boletoComissao : lsBoletoComissao) { - total = total.add(boletoComissao.getTotal()); + if(lStatusBilhete == null || lStatusBilhete.contains(boletoComissao.getIndstatusboletoEnum())) { + total = total.add(boletoComissao.getTotal()); + } } } return total; @@ -286,16 +327,13 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic BigDecimal totalOcd = BigDecimal.ZERO; if(lsBoletoComissao != null) { for (BoletoComissao boletoComissao : lsBoletoComissao) { - if(boletoComissao.getOcdId() != null && - boletoComissao.getIndstatusboleto().equals(IndStatusBoleto.C.getShortValue()) && - boletoComissao.getMotivoCancelacionId() == Constantes.MVO_CANCEL_DEVOLUCAO.intValue()) { + log.info(boletoComissao.getNumFolioSistema()); + log.info(boletoComissao.getSituacaoBilhete()); + if(boletoComissao.isOcd()) { totalOcd = totalOcd.add(boletoComissao.getTotal()); - } else if(boletoComissao.getIndstatusboleto().equals(IndStatusBoleto.C.getShortValue()) && - boletoComissao.getMotivoCancelacionId() == Constantes.MVO_CANCEL_DEVOLUCAO.intValue()) { + } else if(boletoComissao.isStatusCancelado() && boletoComissao.isMotivocancelacionDevolvido()) { totalDevolvidos = totalDevolvidos.add(boletoComissao.getTotal()); - } else if(boletoComissao.getIndstatusboleto().equals(IndStatusBoleto.T.getShortValue()) || - (boletoComissao.getIndstatusboleto().equals(IndStatusBoleto.C.getShortValue()) && - boletoComissao.getMotivoCancelacionId() == Constantes.MVO_CANCEL_TROCA.intValue())) { + } else if(boletoComissao.isStatusCancelado() && boletoComissao.isMotivocancelacionTrocado()) { totalTroca = totalTroca.add(boletoComissao.getTotal()); } } @@ -358,8 +396,7 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic private BigDecimal carregarTotalDevolvidosDinhero(List boletoComissaos) { BigDecimal totalDevolvidoDinheiro = BigDecimal.ZERO; for (BoletoComissao boletoComissao : boletoComissaos) { - if(boletoComissao.getIndstatusboleto().equals(IndStatusBoleto.C.getShortValue()) && - boletoComissao.getMotivoCancelacionId() == Constantes.MVO_CANCEL_DEVOLUCAO.intValue()) { + if(boletoComissao.isStatusCancelado() && boletoComissao.isMotivocancelacionDevolvido() && !boletoComissao.isOcd()) { for (FormapagoVO formapago : boletoComissao.getFormapagos()) { if(formapago.getFormapagoId() == Constantes.FORMA_PAGO_DINHEIRO.intValue()) { totalDevolvidoDinheiro = totalDevolvidoDinheiro.add(formapago.getImporte()); @@ -382,10 +419,8 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic private void carregarTotalFormapago(ResumoComissao resumoComissao, List boletoComissaos, List lsEventosFinanceiros) { List totalFormapagos = new ArrayList(); for (BoletoComissao boletoComissao : boletoComissaos) { - if(boletoComissao.getIndstatusboleto().equals(IndStatusBoleto.V.getShortValue()) && - (boletoComissao.getMotivoCancelacionId() == null || - boletoComissao.getMotivoCancelacionId() != Constantes.MVO_CANCEL_CANCELACION.intValue() || - boletoComissao.getMotivoCancelacionId() != Constantes.MVO_CANCEL_DEVOLUCAO.intValue())) { + if(boletoComissao.isStatusVendido() && + (boletoComissao.isSemMotivocancelacion() || boletoComissao.isMotivocancelacionCancelado() || boletoComissao.isMotivocancelacionDevolvido())) { for (FormapagoVO formapagoBoleto : boletoComissao.getFormapagos()) { FormapagoVO formapago; if(totalFormapagos.contains(formapagoBoleto)) { @@ -493,89 +528,4 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic return conferenciaComissaoDAO.isConferenciaCompetenciaEncerrada(competencia, empresa, puntoVenta); } - public boolean isBilhetesManualVendido(BoletoComissao boletoComissao) { - return boletoComissao.getTipoVenta() == Constantes.TPV_MANUAL.intValue() && - boletoComissao.getIndstatusboleto().equals(IndStatusBoleto.V.getShortValue()); - } - - public boolean isBilhetesNormalVendido(BoletoComissao boletoComissao) { - return (boletoComissao.getTipoVenta() == Constantes.TPV_DIRECTO_NORMAL.intValue() || boletoComissao.getTipoVenta() == Constantes.TPV_CHECKIN_VIAGEM.intValue()) - && - (boletoComissao.getIndstatusboleto().equals(IndStatusBoleto.V.getShortValue()) && - (boletoComissao.getMotivoCancelacionId() == null || - boletoComissao.getMotivoCancelacionId() == Constantes.MVO_CANCEL_TROCA.intValue())); - } - - public boolean isBilhetesImpresso(BoletoComissao boletoComissao) { - return boletoComissao.getTipoVenta() == Constantes.TPV_BOLETO_REMOTO.intValue() && - boletoComissao.getIndstatusboleto().equals(IndStatusBoleto.E.getShortValue()); - } - - public boolean isBilhetesNormalCancelado(BoletoComissao boletoComissao) { - return boletoComissao.getTipoVenta() == Constantes.TPV_DIRECTO_NORMAL.intValue() && - boletoComissao.getIndstatusboleto().equals(IndStatusBoleto.C.getShortValue()) && - boletoComissao.getMotivoCancelacionId() == Constantes.MVO_CANCEL_CANCELACION.intValue(); - } - - public boolean isBilhetesNormalDevolvido(BoletoComissao boletoComissao) { - return (boletoComissao.getTipoVenta() == Constantes.TPV_DIRECTO_NORMAL.intValue() || - boletoComissao.getTipoVentaOriginal() == Constantes.TPV_DIRECTO_NORMAL.intValue() || - (boletoComissao.getTipoVentaOriginal() == Constantes.TPV_BOLETO_REMOTO.intValue() && StringUtils.isNotBlank(boletoComissao.getNumFolioSistema()))) && - boletoComissao.getIndstatusboleto().equals(IndStatusBoleto.C.getShortValue()) && - boletoComissao.getMotivoCancelacionId() == Constantes.MVO_CANCEL_DEVOLUCAO.intValue(); - } - - public boolean isBilhetesNormalTrocado(BoletoComissao boletoComissao) { - return (boletoComissao.getTipoVenta() == Constantes.TPV_TRANSFERENCIAS.intValue() && - (boletoComissao.getTipoVentaOriginal() == Constantes.TPV_DIRECTO_NORMAL.intValue()) && - boletoComissao.getIndstatusboleto().equals(IndStatusBoleto.T.getShortValue())) - || - (boletoComissao.getTipoVenta() == Constantes.TPV_TRANSFERENCIAS.intValue() && - (boletoComissao.getTipoVentaOriginal() == Constantes.TPV_DIRECTO_NORMAL.intValue()) && - boletoComissao.getIndstatusboleto().equals(IndStatusBoleto.C.getShortValue()) && - boletoComissao.getMotivoCancelacionId() == Constantes.MVO_CANCEL_TROCA.intValue()) - || - (boletoComissao.getTipoVenta() == Constantes.TPV_CAMBIO_VIAJE.intValue() && - (boletoComissao.getTipoVentaOriginal() == Constantes.TPV_DIRECTO_NORMAL.intValue()) && - boletoComissao.getIndstatusboleto().equals(IndStatusBoleto.C.getShortValue()) && - boletoComissao.getMotivoCancelacionId() == Constantes.MVO_CANCEL_TROCA.intValue()); - } - - public boolean isBilhetesNormalTranferido(BoletoComissao boletoComissao) { - return (boletoComissao.getTipoVenta() == Constantes.TPV_CAMBIO_VIAJE.intValue()) && - boletoComissao.getTipoVentaOriginal() == Constantes.TPV_DIRECTO_NORMAL.intValue() && - boletoComissao.getIndstatusboleto().equals(IndStatusBoleto.T.getShortValue()); - } - - public boolean isBilhetesGapVendido(BoletoComissao boletoComissao) { - return boletoComissao.getTipoVenta() == Constantes.TPV_BOLETO_REMOTO.intValue() && - (boletoComissao.getIndstatusboleto().equals(IndStatusBoleto.V.getShortValue()) || - boletoComissao.getIndstatusboleto().equals(IndStatusBoleto.T.getShortValue())); - } - - public boolean isBilhetesGapCancelado(BoletoComissao boletoComissao) { - return boletoComissao.getTipoVenta() == Constantes.TPV_BOLETO_REMOTO.intValue() && - boletoComissao.getIndstatusboleto().equals(IndStatusBoleto.C.getShortValue()) && - boletoComissao.getMotivoCancelacionId() == Constantes.MVO_CANCEL_CANCELACION.intValue(); - } - - public boolean isBilhetesGapDevolvido(BoletoComissao boletoComissao) { - return boletoComissao.getTipoVenta() == Constantes.TPV_BOLETO_REMOTO.intValue() && - boletoComissao.getIndstatusboleto().equals(IndStatusBoleto.C.getShortValue()) && - boletoComissao.getMotivoCancelacionId() == Constantes.MVO_CANCEL_DEVOLUCAO.intValue() && - StringUtils.isBlank(boletoComissao.getNumFolioSistema()); - } - - public boolean isBilhetesGapTrocado(BoletoComissao boletoComissao) { - return boletoComissao.getTipoVenta() == Constantes.TPV_TRANSFERENCIAS.intValue() && - boletoComissao.getTipoVentaOriginal() == Constantes.TPV_BOLETO_REMOTO.intValue() && - boletoComissao.getIndstatusboleto().equals(IndStatusBoleto.T.getShortValue()); - } - - public boolean isBilhetesGapTransferido(BoletoComissao boletoComissao) { - return boletoComissao.getTipoVenta() == Constantes.TPV_CAMBIO_VIAJE.intValue() && - boletoComissao.getTipoVentaOriginal() == Constantes.TPV_BOLETO_REMOTO.intValue() && - boletoComissao.getIndstatusboleto().equals(IndStatusBoleto.T.getShortValue()); - } - } diff --git a/src/com/rjconsultores/ventaboletos/vo/comissao/BoletoComissao.java b/src/com/rjconsultores/ventaboletos/vo/comissao/BoletoComissao.java index 716be5667..f5668019c 100644 --- a/src/com/rjconsultores/ventaboletos/vo/comissao/BoletoComissao.java +++ b/src/com/rjconsultores/ventaboletos/vo/comissao/BoletoComissao.java @@ -35,6 +35,7 @@ public class BoletoComissao { private String numFolioPreImpreso; private String uf; private String desccategoria; + private String nombpasajero; private Integer status; private String numoperacion; private Integer tipoVentaOriginal1; @@ -260,7 +261,7 @@ public class BoletoComissao { public int hashCode() { final int prime = 31; int result = 1; - result = prime * result + ((boletoId == null) ? 0 : boletoId.hashCode()); + result = prime * result + ((getBoletoId() == null) ? 0 : getBoletoId().hashCode()); return result; } @@ -271,10 +272,10 @@ public class BoletoComissao { if (obj == null) return false; BoletoComissao other = (BoletoComissao) obj; - if (boletoId == null) { - if (other.boletoId != null) + if (getBoletoId() == null) { + if (other.getBoletoId() != null) return false; - } else if (!boletoId.equals(other.boletoId)) + } else if (!getBoletoId().equals(other.getBoletoId())) return false; return true; } @@ -359,26 +360,32 @@ public class BoletoComissao { } public String getSituacaoBilhete() { - if(getOcdId() != null && - getIndstatusboleto().equalsIgnoreCase(IndStatusBoleto.C.getShortValue()) && - getMotivoCancelacionId() == Constantes.MVO_CANCEL_DEVOLUCAO.intValue()) { + if(isOcd()) { return "OCD"; - } else if(getIndstatusboleto().equalsIgnoreCase(IndStatusBoleto.C.getShortValue()) && - StringUtils.isNotBlank(getDescmotivocancelacion())) { + } else if((isStatusCancelado()) && (isMotivocancelacionDevolvido() || isMotivocancelacionCancelado()) && StringUtils.isNotBlank(getDescmotivocancelacion())) { return getDescmotivocancelacion(); - } else if(getIndstatusboleto().equalsIgnoreCase(IndStatusBoleto.T.getShortValue())) { - if (tipoVenta == Constantes.TPV_TRANSFERENCIAS.intValue()) { - return "TROCADO"; - } else if (tipoVenta == Constantes.TPV_CAMBIO_VIAJE.intValue()) { - return "TRANSFERIDO"; - } else { - IndStatusBoleto indStatusBoleto = IndStatusBoleto.getIndStatusBoleto(getIndstatusboleto()); - return indStatusBoleto != null ? indStatusBoleto.getValue() : ""; + } else if((isStatusCancelado()) && !isMotivocancelacionDevolvido() && !isMotivocancelacionCancelado()) { + if (isMotivocancelacionTrocado()) { + return "B. VENDIDO TROCADO"; + } else if (isMotivocancelacionTransferido()) { + return "B. VENDIDO TRANSFERIDO"; + } + } else if(isStatusTroca()) { + if (isVendaBilheteTroca(getTipoVenta()) || isVendaGap(getTipoVenta())) { + return "B. DA TROCA"; + } else if (isVendaBilheteTransferencia(getTipoVenta()) || isVendaGap(getTipoVenta())) { + return "B. DA TRANSFERENCIA"; + } else if (isVendaBilheteConfirmaAberto(getTipoVenta())) { + return "CONFIRMAÇÃO ABERTO"; } - } else { - IndStatusBoleto indStatusBoleto = IndStatusBoleto.getIndStatusBoleto(getIndstatusboleto()); - return indStatusBoleto != null ? indStatusBoleto.getValue() : ""; } + + IndStatusBoleto indStatusBoleto = IndStatusBoleto.getIndStatusBoleto(getIndstatusboleto()); + return indStatusBoleto != null ? indStatusBoleto.getValue() : ""; + } + + public boolean isOcd() { + return getOcdId() != null && isStatusCancelado() && isMotivocancelacionDevolvido(); } public String getNombusuario() { @@ -468,5 +475,244 @@ public class BoletoComissao { public void setOcdId(Integer ocdId) { this.ocdId = ocdId; } + + public boolean isVendaManual(Integer tipoVenta) { + return tipoVenta == Constantes.TPV_MANUAL.intValue(); + } + + public boolean isVendaGap(Integer tipoVenta) { + return tipoVenta == Constantes.TPV_BOLETO_REMOTO.intValue() || + tipoVenta == Constantes.TPV_CALL_CENTER.intValue() || + tipoVenta == Constantes.TPV_POR_INTERNET.intValue(); + } + + public boolean isVendaBilheteNormal(Integer tipoVenta) { + return tipoVenta == Constantes.TPV_DIRECTO_NORMAL.intValue(); + } + + public boolean isVendaBilheteTroca(Integer tipoVenta) { + return tipoVenta == Constantes.TPV_TRANSFERENCIAS.intValue(); + } + + public boolean isVendaBilheteTransferencia(Integer tipoVenta) { + return tipoVenta == Constantes.TPV_CAMBIO_VIAJE.intValue(); + } + + public boolean isVendaBilheteManual(Integer tipoVenta) { + return tipoVenta == Constantes.TPV_MANUAL.intValue(); + } + + public boolean isVendaBilheteAberto(Integer tipoVenta) { + return tipoVenta == Constantes.TPV_BOLETO_ABIERTO.intValue(); + } + + public boolean isVendaBilheteConfirmaAberto(Integer tipoVenta) { + return tipoVenta == Constantes.TPV_CONFIRMA_ABIERTO.intValue(); + } + + public boolean isVendaBilheteCheckin(Integer tipoVenta) { + return tipoVenta == Constantes.TPV_CHECKIN_VIAGEM.intValue(); + } + + public boolean isSemMotivocancelacion() { + return getMotivoCancelacionId() == null; + } + + public boolean isMotivocancelacionCancelado() { + return !isSemMotivocancelacion() && getMotivoCancelacionId() == Constantes.MVO_CANCEL_CANCELACION.intValue(); + } + + public boolean isMotivocancelacionDevolvido() { + return !isSemMotivocancelacion() && getMotivoCancelacionId() == Constantes.MVO_CANCEL_DEVOLUCAO.intValue(); + } + + public boolean isMotivocancelacionEntregaGap() { + return !isSemMotivocancelacion() && getMotivoCancelacionId() == Constantes.MVO_CANCEL_BOLETO_ENTREGADO.intValue(); + } + public boolean isMotivocancelacionTransferido() { + return !isSemMotivocancelacion() && getMotivoCancelacionId() == Constantes.MVO_CANCEL_TRANSFERENCIA.intValue(); + } + + public boolean isMotivocancelacionTrocado() { + return !isSemMotivocancelacion() && getMotivoCancelacionId() == Constantes.MVO_CANCEL_TROCA.intValue(); + } + + public boolean isMotivocancelacionCheckin() { + return !isSemMotivocancelacion() && getMotivoCancelacionId() == Constantes.MVO_CANCEL_CHECKIN.intValue(); + } + + /** ABA BILHETE MANUAL */ + public boolean isBilhetesManualVendido() { + return isVendaBilheteManual(getTipoVenta()) && isStatusVendido(); + } + + /** ABA BILHETE VENDIDO */ + public boolean isBilheteNormalVendido() { + return (isVendaBilheteNormal(getTipoVenta()) && isSemMotivocancelacion() && isStatusVendido()) || // Venda sem alteração + (isVendaBilheteNormal(getTipoVenta()) && isStatusVendido() && isMotivocancelacionTrocado()) || // Venda trocada + (isVendaBilheteNormal(getTipoVenta()) && isStatusVendido() && isMotivocancelacionTransferido()) || // Venda transferida + (isVendaBilheteNormal(getTipoVenta()) && isStatusVendido() && isMotivocancelacionCancelado()) || // Venda cancelada + (isVendaBilheteNormal(getTipoVenta()) && isStatusVendido() && isMotivocancelacionDevolvido()) || // Venda devolvida + (isVendaBilheteTroca(getTipoVenta()) && isStatusTroca() && isSemMotivocancelacion()) || // Novo bilhete da troca + (isVendaBilheteTransferencia(getTipoVenta()) && isStatusTroca() && isSemMotivocancelacion()) || // Novo bilhete transferido + (isVendaBilheteTroca(getTipoVenta()) && isStatusTroca() && isMotivocancelacionDevolvido()) || // Novo bilhete da troca devolvido + (isVendaBilheteTransferencia(getTipoVenta()) && isStatusTroca() && isMotivocancelacionCancelado()) || // Novo bilhete transferido devolvido + (isVendaBilheteTroca(getTipoVenta()) && isStatusTroca() && isMotivocancelacionDevolvido()) || // Novo bilhete da troca cancelado + (isVendaBilheteTransferencia(getTipoVenta()) && isStatusTroca() && isMotivocancelacionCancelado()); // Novo bilhete transferido cancelado + } + + /** ABA BILHETE DEVOLVIDO */ + public boolean isBilheteNormalTrocado() { + return isVendaBilheteNormal(getTipoVenta()) && isStatusCancelado() && isMotivocancelacionTrocado(); + } + + /** ABA BILHETE VENDIDO */ + public boolean isBilheteNormalChekin() { + return isVendaBilheteCheckin(getTipoVenta()) && isStatusVendido() && isMotivocancelacionCheckin(); + } + + /** ABA BILHETE VENDIDO */ + public boolean isBilheteAberto() { + return isVendaBilheteAberto(getTipoVenta()) && isStatusVendido(); + } + + /** ABA BILHETE VENDIDO */ + public boolean isBilheteEntregaAberto() { + return isVendaBilheteConfirmaAberto(getTipoVenta()) && isStatusTroca(); + } + + /** ABA BILHETE CANCELADO */ + public boolean isBilheteAbertoCancelado() { + return isVendaBilheteConfirmaAberto(getTipoVenta()) && isStatusCancelado() && isMotivocancelacionCancelado(); + } + + /** ABA BILHETE DEVOLVIDO */ + public boolean isBilheteAbertoDevolvido() { + return isVendaBilheteConfirmaAberto(getTipoVenta()) && isStatusCancelado() && isMotivocancelacionDevolvido(); + } + + /** ABA BILHETE DEVOLVIDO */ + public boolean isBilheteNormalDevolvido() { + return isVendaBilheteNormal(getTipoVenta()) && isMotivocancelacionDevolvido() && isStatusCancelado(); + } + + /** ABA BILHETE CANCELADO */ + public boolean isBilheteNormalCancelado() { + return isVendaBilheteNormal(getTipoVenta()) && isMotivocancelacionCancelado() && isStatusCancelado(); + } + + /** ABA BILHETE DEVOLVIDO */ + public boolean isBilheteNormalTrocadoDevolvido() { + return isVendaBilheteTroca(getTipoVenta()) && isStatusCancelado() && isMotivocancelacionDevolvido(); + } + + /** ABA BILHETE DEVOLVIDO */ + public boolean isBilheteNormalTransferidoDevolvido() { + return isVendaBilheteTransferencia(getTipoVenta()) && isStatusCancelado() && isMotivocancelacionDevolvido(); + } + + /** ABA BILHETE CANCELADO */ + public boolean isBilheteNormalTrocadoCancelado() { + return isVendaBilheteTroca(getTipoVenta()) && isStatusCancelado() && isMotivocancelacionCancelado(); + } + + /** ABA GAP VENDIDA */ + public boolean isBilheteGapVendido() { + return (isVendaGap(getTipoVenta()) && isSemMotivocancelacion() && isStatusVendido()) && StringUtils.isBlank(getNumFolioSistema()) || // Gap sem alteração + (isVendaGap(getTipoVenta()) && isStatusVendido() && isMotivocancelacionEntregaGap()) && StringUtils.isBlank(getNumFolioSistema()) || // Gap entregue + (isVendaGap(getTipoVenta()) && isStatusTroca() && isMotivocancelacionEntregaGap()) && StringUtils.isBlank(getNumFolioSistema()) || // Gap entregue + (isVendaGap(getTipoVenta()) && isStatusVendido() && isMotivocancelacionTrocado()) && StringUtils.isBlank(getNumFolioSistema()) || // Gap trocada + (isVendaGap(getTipoVenta()) && isStatusVendido() && isMotivocancelacionTransferido()) && StringUtils.isBlank(getNumFolioSistema()) || // Gap transferida + (isVendaGap(getTipoVenta()) && isStatusVendido() && isMotivocancelacionCancelado()) && StringUtils.isBlank(getNumFolioSistema()) || // Gap cancelada + (isVendaGap(getTipoVenta()) && isStatusVendido() && isMotivocancelacionDevolvido()) && StringUtils.isBlank(getNumFolioSistema()) || // Gap devolvida + (isVendaGap(getTipoVenta()) && isStatusTroca() && isSemMotivocancelacion()) && StringUtils.isBlank(getNumFolioSistema()) || // Gap Novo bilhete da troca + (isVendaGap(getTipoVenta()) && isStatusTroca() && isSemMotivocancelacion()) && StringUtils.isBlank(getNumFolioSistema()) || // Gap Novo bilhete transferido + (isVendaGap(getTipoVenta()) && isStatusTroca() && isMotivocancelacionDevolvido()) && StringUtils.isBlank(getNumFolioSistema()) || // Gap Novo bilhete da troca devolvido + (isVendaGap(getTipoVenta()) && isStatusTroca() && isMotivocancelacionCancelado()) && StringUtils.isBlank(getNumFolioSistema()) || // Gap Novo bilhete transferido devolvido + (isVendaGap(getTipoVenta()) && isStatusTroca() && isMotivocancelacionDevolvido()) && StringUtils.isBlank(getNumFolioSistema()) || // Gap Novo bilhete da troca cancelado + (isVendaGap(getTipoVenta()) && isStatusTroca() && isMotivocancelacionCancelado()) && StringUtils.isBlank(getNumFolioSistema()); // Gap Novo bilhete transferido cancelado + } + + /** ABA GAP DEVOLVIDO */ + public boolean isBilheteGapTrocado() { + return isVendaGap(getTipoVenta()) && isStatusCancelado() && isMotivocancelacionTrocado() && StringUtils.isBlank(getNumFolioSistema()); + } + + /** ABA GAP DEVOLVIDO */ + public boolean isBilheteGapTrocadoDevolvido() { + return isVendaGap(getTipoVenta()) && isMotivocancelacionTrocado() && isStatusCancelado() && StringUtils.isBlank(getNumFolioSistema()); + } + + /** ABA GAP CANCELADO */ + public boolean isBilheteGapTrocadoCancelado() { + return isVendaGap(getTipoVenta()) && isMotivocancelacionCancelado() && isStatusCancelado() && StringUtils.isBlank(getNumFolioSistema()); + } + + /** ABA GAP CANCELADO */ + public boolean isBilheteGapCancelado() { + return isVendaGap(getTipoVenta()) && isMotivocancelacionCancelado() && isStatusCancelado() && StringUtils.isBlank(getNumFolioSistema()); + } + + /** ABA GAP DEVOLVIDO */ + public boolean isBilheteGapDevolvido() { + return isVendaGap(getTipoVenta()) && isMotivocancelacionDevolvido() && isStatusCancelado() && StringUtils.isBlank(getNumFolioSistema()); + } + + /** ABA BILHETE VENDIDO */ + public boolean isBilheteEntregaGap() { + return isVendaGap(getTipoVenta()) && isStatusEntregue() && StringUtils.isNotBlank(getNumFolioSistema()); + } + + /** ABA BILHETE DEVOLVIDO */ + public boolean isBilheteEntregaGapTrocado() { + return isVendaGap(getTipoVenta()) && isStatusEntregue() && isMotivocancelacionTrocado() && StringUtils.isNotBlank(getNumFolioSistema()); + } + + /** ABA BILHETE DEVOLVIDO */ + public boolean isBilheteEntregaGapDevolvido() { + return isVendaGap(getTipoVenta()) && isStatusCancelado() && isMotivocancelacionDevolvido() && StringUtils.isNotBlank(getNumFolioSistema()); + } + + /** ABA BILHETE CANCELADO */ + public boolean isBilheteEntregaGapCancelado() { + return isVendaGap(getTipoVenta()) && isStatusCancelado() && isMotivocancelacionCancelado() && StringUtils.isNotBlank(getNumFolioSistema()); + } + + public boolean isStatusVendido() { + return getIndstatusboletoEnum().equals(IndStatusBoleto.V); + } + + public boolean isStatusCancelado() { + return getIndstatusboletoEnum().equals(IndStatusBoleto.C); + } + + public boolean isStatusEntregue() { + return getIndstatusboletoEnum().equals(IndStatusBoleto.E); + } + + public boolean isStatusTroca() { + return getIndstatusboletoEnum().equals(IndStatusBoleto.T); + } + + public boolean isStatusExtraviado() { + return getIndstatusboletoEnum().equals(IndStatusBoleto.X); + } + + public boolean isStatusMarcado() { + return getIndstatusboletoEnum().equals(IndStatusBoleto.M); + } + + public String getNombpasajero() { + return nombpasajero; + } + + public void setNombpasajero(String nombpasajero) { + this.nombpasajero = nombpasajero; + } + + public IndStatusBoleto getIndstatusboletoEnum() { + return IndStatusBoleto.getIndStatusBoleto(getIndstatusboleto()); + } + } \ No newline at end of file