gleimar 2017-02-10 19:21:24 +00:00
parent 996b640187
commit f46c9cd38c
1 changed files with 81 additions and 3 deletions

View File

@ -596,11 +596,68 @@ public class ConferenciaController extends MyGenericForwardComposer {
carregarOcds(); carregarOcds();
carregarLogsConferencia(); carregarLogsConferencia();
carregarResumo(boletosComissaos); carregarResumo(boletosComissaos);
this.ajustarPendentes(boletosComissaos);
} catch (BusinessException e) { } catch (BusinessException e) {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
} }
} }
/**
* Metodo criado com o objetivo de adicionar os bilhetes não classificados previamente.
*
* Ou seja, casos ainda existam bilhetes após a classificação, os mesmos serão separadas em cancelados e vendidos
*
* @param boletosComissaos
* @throws BusinessException
*/
private void ajustarPendentes(List<BoletoComissao> boletosComissaos) throws BusinessException {
boletosComissaos.removeAll(this.lsBilhetes);
boletosComissaos.removeAll(this.lsBilhetesCancelados);
boletosComissaos.removeAll(this.lsBilhetesDevolvidos);
boletosComissaos.removeAll(this.lsBilhetesGap);
boletosComissaos.removeAll(this.lsBilhetesGapCancelados);
boletosComissaos.removeAll(this.lsBilhetesGapDevolvidos);
boletosComissaos.removeAll(this.lsBilhetesManual);
boolean vendidosAtualizado = false;
boolean canceladoAtualizado = false;
boolean devolvidoAtualizado = false;
for (BoletoComissao b: boletosComissaos){
if (b.getIndCancelacion()){
if (b.isMotivocancelacionDevolvido()){
this.lsBilhetesDevolvidos.add(b);
devolvidoAtualizado = true;
}else{
this.lsBilhetesCancelados.add(b);
canceladoAtualizado = true;
}
}else{
this.lsBilhetes.add(b);
vendidosAtualizado = true;
}
}
//recarrega as informações
if (vendidosAtualizado){
this.carregarBilhetesVendidos();
}
//recarrega as informações
if (canceladoAtualizado){
this.carregarBilhetesCancelados();
}
//recarrega as informações
if (devolvidoAtualizado){
this.carregarBilhetesDevolvidos();
}
}
private void carregarResumo(List<BoletoComissao> boletosComissaos) throws BusinessException { private void carregarResumo(List<BoletoComissao> boletosComissaos) throws BusinessException {
resumo = conferenciaComissaoService.gerarResumo(conferencia, boletosComissaos, lsEventosFinanceiros, totalBilhetesManual, totalBilhetesVendidos, totalBilhetesCancelados, totalBilhetesDevolvidos, totalBilhetesGap, totalBilhetesGapCancelados, totalBilhetesGapDevolvidos, totalCreditosEventoFinanceiros, totalDebitosEventoFinanceiros, ocdTotal); resumo = conferenciaComissaoService.gerarResumo(conferencia, boletosComissaos, lsEventosFinanceiros, totalBilhetesManual, totalBilhetesVendidos, totalBilhetesCancelados, totalBilhetesDevolvidos, totalBilhetesGap, totalBilhetesGapCancelados, totalBilhetesGapDevolvidos, totalCreditosEventoFinanceiros, totalDebitosEventoFinanceiros, ocdTotal);
formapagosList.setData(resumo.getTotalFormapago()); formapagosList.setData(resumo.getTotalFormapago());
@ -617,7 +674,11 @@ public class ConferenciaController extends MyGenericForwardComposer {
} }
private void carregarBilhetesVendidos(List<BoletoComissao> boletosComissaos) throws BusinessException { private void carregarBilhetesVendidos(List<BoletoComissao> boletosComissaos) throws BusinessException {
lsBilhetes = conferenciaComissaoService.carregarBilhetesComissao(boletosComissaos, conferencia, BoletoStatusComissao.BOLETOS_VENDIDOS);
if (boletosComissaos != null){
lsBilhetes = conferenciaComissaoService.carregarBilhetesComissao(boletosComissaos, conferencia, BoletoStatusComissao.BOLETOS_VENDIDOS);
}
totalBilhetesVendidos = conferenciaComissaoService.totalizarBoletoComissao(lsBilhetes, IndStatusBoleto.V, IndStatusBoleto.T); totalBilhetesVendidos = conferenciaComissaoService.totalizarBoletoComissao(lsBilhetes, IndStatusBoleto.V, IndStatusBoleto.T);
txtTotalBilhetes.setValue(BigDecimalUtil.getBigDecimalToStringDouble2CasasDecimaisFormatado(totalBilhetesVendidos, LocaleUtil.getLocale())); txtTotalBilhetes.setValue(BigDecimalUtil.getBigDecimalToStringDouble2CasasDecimaisFormatado(totalBilhetesVendidos, LocaleUtil.getLocale()));
txtQtdeTotalBilhetes.setValue(String.valueOf(lsBilhetes.size())); txtQtdeTotalBilhetes.setValue(String.valueOf(lsBilhetes.size()));
@ -625,9 +686,19 @@ public class ConferenciaController extends MyGenericForwardComposer {
verificarBilhetesSemConferencia(lsBilhetes, tabBilhetesVenda); verificarBilhetesSemConferencia(lsBilhetes, tabBilhetesVenda);
} }
private void carregarBilhetesVendidos() throws BusinessException {
this.carregarBilhetesVendidos(null);
}
private void carregarBilhetesCancelados() throws BusinessException {
this.carregarBilhetesCancelados(null);
}
private void carregarBilhetesCancelados(List<BoletoComissao> boletosComissaos) throws BusinessException { private void carregarBilhetesCancelados(List<BoletoComissao> boletosComissaos) throws BusinessException {
lsBilhetesCancelados = conferenciaComissaoService.carregarBilhetesComissao(boletosComissaos, conferencia, BoletoStatusComissao.BOLETO_CANCELADO); if (boletosComissaos != null){
lsBilhetesCancelados = conferenciaComissaoService.carregarBilhetesComissao(boletosComissaos, conferencia, BoletoStatusComissao.BOLETO_CANCELADO);
}
totalBilhetesCancelados = conferenciaComissaoService.totalizarBoletoComissao(lsBilhetesCancelados); totalBilhetesCancelados = conferenciaComissaoService.totalizarBoletoComissao(lsBilhetesCancelados);
txtTotalBilhetesCancelados.setValue(BigDecimalUtil.getBigDecimalToStringDouble2CasasDecimaisFormatado(totalBilhetesCancelados, LocaleUtil.getLocale())); txtTotalBilhetesCancelados.setValue(BigDecimalUtil.getBigDecimalToStringDouble2CasasDecimaisFormatado(totalBilhetesCancelados, LocaleUtil.getLocale()));
txtQtdeTotalBilhetesCancelados.setValue(String.valueOf(lsBilhetesCancelados.size())); txtQtdeTotalBilhetesCancelados.setValue(String.valueOf(lsBilhetesCancelados.size()));
@ -636,9 +707,16 @@ public class ConferenciaController extends MyGenericForwardComposer {
verificarBilhetesSemConferencia(lsBilhetesCancelados, tabBilhetesCancelados); verificarBilhetesSemConferencia(lsBilhetesCancelados, tabBilhetesCancelados);
} }
private void carregarBilhetesDevolvidos() throws BusinessException {
this.carregarBilhetesDevolvidos(null);
}
private void carregarBilhetesDevolvidos(List<BoletoComissao> boletosComissaos) throws BusinessException { private void carregarBilhetesDevolvidos(List<BoletoComissao> boletosComissaos) throws BusinessException {
totalBilhetesDevolvidos = BigDecimal.ZERO; totalBilhetesDevolvidos = BigDecimal.ZERO;
lsBilhetesDevolvidos = conferenciaComissaoService.carregarBilhetesComissao(boletosComissaos, conferencia, BoletoStatusComissao.BOLETO_DEVOLVIDO);
if (boletosComissaos != null){
lsBilhetesDevolvidos = conferenciaComissaoService.carregarBilhetesComissao(boletosComissaos, conferencia, BoletoStatusComissao.BOLETO_DEVOLVIDO);
}
Map<BoletoStatusComissao, BigDecimal> totais = conferenciaComissaoService.totalizarBoletoComissaoDevolvidosTrocaOcd(lsBilhetesDevolvidos); Map<BoletoStatusComissao, BigDecimal> totais = conferenciaComissaoService.totalizarBoletoComissaoDevolvidosTrocaOcd(lsBilhetesDevolvidos);
totalBilhetesDevolvidos = totais.get(BoletoStatusComissao.BOLETO_DEVOLVIDO); totalBilhetesDevolvidos = totais.get(BoletoStatusComissao.BOLETO_DEVOLVIDO);