valdevir 2017-02-09 13:11:31 +00:00
parent 59fbf9a0cb
commit 55f465d43d
1 changed files with 16 additions and 71 deletions

View File

@ -636,18 +636,7 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
List<Empresa> lsEmpresa = empresaService.obtenerTodos();
for (Empresa empresa : lsEmpresa) {
lsPuntoVenta = puntoVentaService.buscaPuntoVentaEmpresa(empresa);
// Percorrer todos os pontos de venda de cada empresa
//TODO - Apagar este if ao final da implementação do mantis 8371.
//if(empresa.getEmpresaId() == 25){
// System.out.println("teste");
//}
for (PuntoVenta puntoVenta : lsPuntoVenta) {
//TODO - Paras testes. Apagar este if e else ao final da implementação do mantis 8371.
//if(puntoVenta.getPuntoventaId() == 4 || "UBERABA".contains(puntoVenta.getNombpuntoventa())){
// System.out.println("teste");
//}else{
// continue;
//}
// Valida se cada ponto de venda tem ao menos uma ecf, caso tenha aborta o processo.
Integer qtdadeECF = quantidadeECFPorPuntoVenta(empresa.getEmpresaId(), puntoVenta.getPuntoventaId());
if (qtdadeECF >= 1) {
@ -705,63 +694,44 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
private boolean validaConferencia(Conferencia conferencia ) {
try {
//BigDecimal totalBilhetesManual = BigDecimal.ZERO;
//BigDecimal totalBilhetesVendidos = BigDecimal.ZERO;
//BigDecimal totalBilhetesCancelados = BigDecimal.ZERO;
//BigDecimal totalBilhetesDevolvidos = BigDecimal.ZERO;
//BigDecimal totalBilhetesGap = BigDecimal.ZERO;
//BigDecimal totalBilhetesGapCancelados = BigDecimal.ZERO;
//BigDecimal totalBilhetesGapDevolvidos = BigDecimal.ZERO;
//BigDecimal totalCreditosEventoFinanceiros = BigDecimal.ZERO;
//BigDecimal totalDebitosEventoFinanceiros = BigDecimal.ZERO;
//OcdVO ocdTotal = null;
//List<EventosFinanceirosVO>lsEventosFinanceiros = null;
List<BoletoComissao> boletosComissaos = carregarBilhetesComissao(null, conferencia, null);
if(boletosComissaos ==null || CollectionUtils.isEmpty(boletosComissaos)){
return false;
}
//totalBilhetesManual = validaBilhetesManual(boletosComissaos, conferencia);
List<BoletoComissao> boletosComissaos = carregarBilhetesComissao(null, conferencia, null);
if(boletosComissaos ==null || CollectionUtils.isEmpty(boletosComissaos)){
return false;
}
if(!validaBilhetesManual(boletosComissaos, conferencia)){
return false;
}
//totalBilhetesVendidos = validaBilhetesVendidos(boletosComissaos, conferencia);
if(!validaBilhetesVendidos(boletosComissaos, conferencia)){
return false;
}
//totalBilhetesCancelados = validaBilhetesCancelados(boletosComissaos, conferencia);
if(!validaBilhetesCancelados(boletosComissaos, conferencia)){
return false;
}
//totalBilhetesDevolvidos = validaBilhetesDevolvidos(boletosComissaos, conferencia);
if(!validaBilhetesDevolvidos(boletosComissaos, conferencia)){
return false;
}
//totalBilhetesGap = validaBilhetesGap(boletosComissaos, conferencia);
if(!validaBilhetesGap(boletosComissaos, conferencia)){
return false;
}
//totalBilhetesGapCancelados = validaBilhetesGapCancelados(boletosComissaos, conferencia);
if(!validaBilhetesGapCancelados(boletosComissaos, conferencia)){
return false;
}
//totalBilhetesGapDevolvidos = validaBilhetesGapDevolvidos(boletosComissaos, conferencia);
if(!validaBilhetesGapDevolvidos(boletosComissaos, conferencia)){
return false;
}
//lsEventosFinanceiros = validaEventosFinanceiros(boletosComissaos, conferencia);
if(!validaEventosFinanceiros(boletosComissaos, conferencia)){
return false;
}
//else{
// for (EventosFinanceirosVO eventoFinanceiro : lsEventosFinanceiros) {
// if (eventoFinanceiro.isCredito()) {
// totalCreditosEventoFinanceiros = totalCreditosEventoFinanceiros.add(eventoFinanceiro.getImpingreso());
// } else {
// totalDebitosEventoFinanceiros = totalDebitosEventoFinanceiros.add(eventoFinanceiro.getImpingreso());
// }
// }
//}
//ocdTotal = validaOcds(conferencia);
if(!validaOcds(conferencia)){
return false;
}
@ -775,62 +745,49 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
private boolean validaBilhetesManual(List<BoletoComissao> boletosComissaos, Conferencia conferencia ) throws BusinessException {
List<BoletoComissao> lsBilhetesManual = carregarBilhetesComissao(boletosComissaos, conferencia, BoletoStatusComissao.BOLETO_MANUAL);
if(!CollectionUtils.isEmpty(lsBilhetesManual) && isBilhetesSemConferencia(lsBilhetesManual)){
//return null;
return false;
}else{
//return totalizarBoletoComissao(lsBilhetesManual, IndStatusBoleto.V);
return true;
}
}
private boolean validaBilhetesVendidos(List<BoletoComissao> boletosComissaos, Conferencia conferencia) throws BusinessException {
List<BoletoComissao> lsBilhetes = carregarBilhetesComissao(boletosComissaos, conferencia, BoletoStatusComissao.BOLETOS_VENDIDOS);
if(!CollectionUtils.isEmpty(lsBilhetes) && isBilhetesSemConferencia(lsBilhetes)){
//return null;
return false;
}else{
//return totalizarBoletoComissao(lsBilhetes, IndStatusBoleto.V, IndStatusBoleto.T);
return true;
}
}
private boolean validaBilhetesCancelados(List<BoletoComissao> boletosComissaos, Conferencia conferencia) throws BusinessException {
List<BoletoComissao> lsBilhetesCancelados = carregarBilhetesComissao(boletosComissaos, conferencia, BoletoStatusComissao.BOLETO_CANCELADO);
if(!CollectionUtils.isEmpty(lsBilhetesCancelados) && isBilhetesSemConferencia(lsBilhetesCancelados)){
//return null;
return false;
}else{
return true;
//return totalizarBoletoComissao(lsBilhetesCancelados);
}
}
private boolean validaBilhetesDevolvidos(List<BoletoComissao> boletosComissaos, Conferencia conferencia) throws BusinessException {
List<BoletoComissao> lsBilhetesDevolvidos = carregarBilhetesComissao(boletosComissaos, conferencia, BoletoStatusComissao.BOLETO_DEVOLVIDO);
if(!CollectionUtils.isEmpty(lsBilhetesDevolvidos) && isBilhetesSemConferencia(lsBilhetesDevolvidos)){
//return null;
return false;
}else{
//Map<BoletoStatusComissao, BigDecimal> totais = totalizarBoletoComissaoDevolvidosTrocaOcd(lsBilhetesDevolvidos);
return true;
//return totais.get(BoletoStatusComissao.BOLETO_DEVOLVIDO);
}
}
private boolean validaBilhetesGap(List<BoletoComissao> boletosComissaos, Conferencia conferencia) throws BusinessException {
List<BoletoComissao> lsBilhetesGap = carregarBilhetesComissao(boletosComissaos, conferencia, BoletoStatusComissao.GAP_VENDIDOS);
if(!CollectionUtils.isEmpty(lsBilhetesGap) && isBilhetesSemConferencia(lsBilhetesGap)){
//return null;
return false;
}else{
//return totalizarBoletoComissao(lsBilhetesGap, IndStatusBoleto.V, IndStatusBoleto.T);
return true;
}
}
private boolean validaBilhetesGapCancelados(List<BoletoComissao> boletosComissaos, Conferencia conferencia ) throws BusinessException {
List<BoletoComissao> lsBilhetesGapCancelados = carregarBilhetesComissao(boletosComissaos, conferencia, BoletoStatusComissao.GAP_CANCELADO);
if(!CollectionUtils.isEmpty(lsBilhetesGapCancelados) && isBilhetesSemConferencia(lsBilhetesGapCancelados)){
//return null;
return false;
}else{
//return totalizarBoletoComissao(lsBilhetesGapCancelados);
return true;
}
}
@ -838,38 +795,26 @@ public class ConferenciaComissaoServiceImpl implements ConferenciaComissaoServic
private boolean validaBilhetesGapDevolvidos(List<BoletoComissao> boletosComissaos, Conferencia conferencia) throws BusinessException {
List<BoletoComissao> lsBilhetesGapDevolvidos = carregarBilhetesComissao(boletosComissaos, conferencia, BoletoStatusComissao.GAP_DEVOLVIDO);
if(!CollectionUtils.isEmpty(lsBilhetesGapDevolvidos) && isBilhetesSemConferencia(lsBilhetesGapDevolvidos)){
//return null;
return false;
}else{
//Map<BoletoStatusComissao, BigDecimal> totais = totalizarBoletoComissaoDevolvidosTrocaOcd(lsBilhetesGapDevolvidos);
return true;
//return totais.get(BoletoStatusComissao.BOLETO_DEVOLVIDO);
}
}
private boolean validaEventosFinanceiros(List<BoletoComissao> boletosComissaos, Conferencia conferencia) throws BusinessException {
List<EventosFinanceirosVO>lsEventosFinanceiros = carregarEventosFinanceiros(conferencia);
if(!CollectionUtils.isEmpty(lsEventosFinanceiros) && isEventosFinanceirosSemConferencia(lsEventosFinanceiros)) {
//return null;
return false;
} else {
return true;
//return lsEventosFinanceiros;
}
}
private boolean validaOcds(Conferencia conferencia) throws BusinessException {
List<OcdVO> lsOcds = carregarOcds(conferencia);
if(!CollectionUtils.isEmpty(lsOcds) && isOcdSemConferencia(lsOcds)) {
//return null;
return false;
} else {
return true;
//return totalizarOcd(lsOcds);
return true;
}
}
// private void carregarResumo(List<BoletoComissao> boletosComissaos, Conferencia conferencia, List<EventosFinanceirosVO> lsEventosFinanceiros, BigDecimal totalBilhetesManual, BigDecimal totalBilhetesVendidos, BigDecimal totalBilhetesCancelados, BigDecimal totalBilhetesDevolvidos,BigDecimal totalBilhetesGap,BigDecimal totalBilhetesGapCancelados,BigDecimal totalBilhetesGapDevolvidos, BigDecimal totalCreditosEventoFinanceiros,BigDecimal totalDebitosEventoFinanceiros, OcdVO ocdTotal ) throws BusinessException {
// gerarResumo(conferencia, boletosComissaos, lsEventosFinanceiros, totalBilhetesManual, totalBilhetesVendidos, totalBilhetesCancelados, totalBilhetesDevolvidos, totalBilhetesGap, totalBilhetesGapCancelados, totalBilhetesGapDevolvidos, totalCreditosEventoFinanceiros, totalDebitosEventoFinanceiros, ocdTotal);
// }
}