Rev 674 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 674 | Rev 675 | ||
|---|---|---|---|
| Line 249... | Line 249... | ||
| 249 | }
|
249 | }
|
| 250 | if (getTipoArquivoSelecionado().equals(ConstantesSEC.ArquivoBanco.ARQUIVO_BANCO_PAGSEGURO_3)) { |
250 | if (getTipoArquivoSelecionado().equals(ConstantesSEC.ArquivoBanco.ARQUIVO_BANCO_PAGSEGURO_3)) { |
| 251 | arquivoBancoPagseguro(getCartaoResumoGeral().getDataInicialVendasSelecionada(), getCartaoResumoGeral().getDataFinalVendasSelecionada()); |
251 | arquivoBancoPagseguro(getCartaoResumoGeral().getDataInicialVendasSelecionada(), getCartaoResumoGeral().getDataFinalVendasSelecionada()); |
| 252 | }
|
252 | }
|
| 253 | if (getTipoArquivoSelecionado().equals(ConstantesSEC.ArquivoBanco.ARQUIVO_BANCO_INTER_5)) { |
253 | if (getTipoArquivoSelecionado().equals(ConstantesSEC.ArquivoBanco.ARQUIVO_BANCO_INTER_5)) { |
| 254 | arquivoBancoPagseguro(getCartaoResumoGeral().getDataInicialVendasSelecionada(), getCartaoResumoGeral().getDataFinalVendasSelecionada()); |
- | |
| - | 254 | arquivoBancoInter(getCartaoResumoGeral().getDataInicialVendasSelecionada(), getCartaoResumoGeral().getDataFinalVendasSelecionada()); |
|
| 255 | }
|
255 | }
|
| 256 | setListaVendaFormaPagamento(vendaFormaPagamentoService.consultarLancamentosCartoesNoPeriodo(getCartaoResumoGeral().getDataInicialVendasSelecionada(), getCartaoResumoGeral().getDataFinalVendasSelecionada(), null, getMaquinetasSelecionadas())); |
256 | setListaVendaFormaPagamento(vendaFormaPagamentoService.consultarLancamentosCartoesNoPeriodo(getCartaoResumoGeral().getDataInicialVendasSelecionada(), getCartaoResumoGeral().getDataFinalVendasSelecionada(), null, getMaquinetasSelecionadas())); |
| 257 | for (VendaFormaPagamento vendaFormaPagamento : getListaVendaFormaPagamento()) { |
257 | for (VendaFormaPagamento vendaFormaPagamento : getListaVendaFormaPagamento()) { |
| 258 | if (VerificadorUtil.estaNulo(vendaFormaPagamento.getCupom())) { |
258 | if (VerificadorUtil.estaNulo(vendaFormaPagamento.getCupom())) { |
| 259 | preencherDados(vendaFormaPagamento); |
259 | preencherDados(vendaFormaPagamento); |
| Line 305... | Line 305... | ||
| 305 | CartaoDTO cartao = new CartaoDTO(); |
305 | CartaoDTO cartao = new CartaoDTO(); |
| 306 | cartao.setBandeira(StringUtil.setarUpperCaseComTrim(dadosSeparados[9])); |
306 | cartao.setBandeira(StringUtil.setarUpperCaseComTrim(dadosSeparados[9])); |
| 307 | FormaPagamento formaPagamento = null; |
307 | FormaPagamento formaPagamento = null; |
| 308 | String bandeira = StringUtil.setarUpperCaseComTrim(dadosSeparados[5]); |
308 | String bandeira = StringUtil.setarUpperCaseComTrim(dadosSeparados[5]); |
| 309 | String tipoCartao = null; |
309 | String tipoCartao = null; |
| 310 | if (bandeira.equals("DÉBITO") || bandeira.equals("DéBITO")) { |
- | |
| - | 310 | if (verificarSeEhDebito(bandeira)) { |
|
| 311 | tipoCartao = TipoCartao.DEBITO.getValor(); |
311 | tipoCartao = TipoCartao.DEBITO.getValor(); |
| 312 | formaPagamento = new FormaPagamento(ConstantesSEC.FormasDePagamento.FORMAPAGAMENTO_DEBITO); |
312 | formaPagamento = new FormaPagamento(ConstantesSEC.FormasDePagamento.FORMAPAGAMENTO_DEBITO); |
| 313 | if (cartao.getBandeira().equals("MASTERCARD")) { |
313 | if (cartao.getBandeira().equals("MASTERCARD")) { |
| 314 | cartao.setBandeira("MAESTRO"); |
314 | cartao.setBandeira("MAESTRO"); |
| 315 | }
|
315 | }
|
| Line 396... | Line 396... | ||
| 396 | }
|
396 | }
|
| 397 | 397 | ||
| 398 | private void arquivoBancoSafra(Date dataInicial, Date dataFinal) { |
398 | private void arquivoBancoSafra(Date dataInicial, Date dataFinal) { |
| 399 | for (String linha : getLinhas()) { |
399 | for (String linha : getLinhas()) { |
| 400 | String[] dadosSeparados = linha.split(";"); |
400 | String[] dadosSeparados = linha.split(";"); |
| 401 | Date dataLinha = DataUtil.retornarDataApartirString("dd/MM/yyyy hh.mm.ss", dadosSeparados[4] + " " + dadosSeparados[5]); |
- | |
| - | 401 | Date dataLinha = DataUtil.retornarDataApartirString("dd/MM/yyyy HH.mm.ss", dadosSeparados[4] + " " + dadosSeparados[5]); |
|
| 402 | if (DataUtils.dataEstaIgualOuEntrePeriodos(DataUtil.retornarDataFormatada("dd/MM/yyyy", dataLinha), dataInicial, dataFinal)) { |
402 | if (DataUtils.dataEstaIgualOuEntrePeriodos(DataUtil.retornarDataFormatada("dd/MM/yyyy", dataLinha), dataInicial, dataFinal)) { |
| 403 | CartaoDTO cartao = new CartaoDTO(); |
403 | CartaoDTO cartao = new CartaoDTO(); |
| 404 | cartao.setBandeira(StringUtil.setarUpperCaseComTrim(dadosSeparados[7])); |
404 | cartao.setBandeira(StringUtil.setarUpperCaseComTrim(dadosSeparados[7])); |
| 405 | FormaPagamento formaPagamento = null; |
405 | FormaPagamento formaPagamento = null; |
| 406 | String bandeira = StringUtil.setarUpperCaseComTrim(dadosSeparados[9]); |
406 | String bandeira = StringUtil.setarUpperCaseComTrim(dadosSeparados[9]); |
| Line 449... | Line 449... | ||
| 449 | CartaoDTO cartao = new CartaoDTO(); |
449 | CartaoDTO cartao = new CartaoDTO(); |
| 450 | cartao.setBandeira(StringUtil.setarUpperCaseComTrim(dadosSeparados[5])); |
450 | cartao.setBandeira(StringUtil.setarUpperCaseComTrim(dadosSeparados[5])); |
| 451 | FormaPagamento formaPagamento = null; |
451 | FormaPagamento formaPagamento = null; |
| 452 | String bandeira = StringUtil.setarUpperCaseComTrim(dadosSeparados[4]); |
452 | String bandeira = StringUtil.setarUpperCaseComTrim(dadosSeparados[4]); |
| 453 | String tipoCartao = null; |
453 | String tipoCartao = null; |
| 454 | if (bandeira.equals("Débito") || bandeira.equals("D�BITO")) { |
- | |
| - | 454 | if (verificarSeEhDebito(bandeira)) { |
|
| 455 | tipoCartao = TipoCartao.DEBITO.getValor(); |
455 | tipoCartao = TipoCartao.DEBITO.getValor(); |
| 456 | formaPagamento = new FormaPagamento(ConstantesSEC.FormasDePagamento.FORMAPAGAMENTO_DEBITO); |
456 | formaPagamento = new FormaPagamento(ConstantesSEC.FormasDePagamento.FORMAPAGAMENTO_DEBITO); |
| 457 | if (cartao.getBandeira().equals("MasterCard") || cartao.getBandeira().equals("MASTERCARD")) { |
457 | if (cartao.getBandeira().equals("MasterCard") || cartao.getBandeira().equals("MASTERCARD")) { |
| 458 | cartao.setBandeira("MAESTRO"); |
458 | cartao.setBandeira("MAESTRO"); |
| 459 | }
|
459 | }
|
| 460 | } else { |
460 | } else { |
| 461 | tipoCartao = TipoCartao.CREDITO.getValor(); |
461 | tipoCartao = TipoCartao.CREDITO.getValor(); |
| 462 | String parcelas = dadosSeparados[6]; |
- | |
| 463 | if (parcelas.equals("À vista") || parcelas.equals("� vista")) { |
- | |
| - | 462 | String parcelas = StringUtil.setarUpperCaseComTrim(dadosSeparados[6]); |
|
| - | 463 | if (verificarSeEhCreditoAvista(parcelas)) { |
|
| 464 | parcelas = "1"; |
464 | parcelas = "1"; |
| 465 | } else if (parcelas.equals("Parcelado")) { |
- | |
| - | 465 | } else if (parcelas.equals("PARCELADO")) { |
|
| 466 | parcelas = "2"; |
466 | parcelas = "2"; |
| 467 | }
|
467 | }
|
| 468 | formaPagamento = new FormaPagamento(FormaPagamento.recuperarCodigoDaFormaDePagamento(parcelas)); |
468 | formaPagamento = new FormaPagamento(FormaPagamento.recuperarCodigoDaFormaDePagamento(parcelas)); |
| 469 | }
|
469 | }
|
| 470 | cartao.setBrutoImportado(new Double(dadosSeparados[7])); |
470 | cartao.setBrutoImportado(new Double(dadosSeparados[7])); |
| Line 476... | Line 476... | ||
| 476 | 476 | ||
| 477 | private void arquivoBancoInter(Date dataInicial, Date dataFinal) { |
477 | private void arquivoBancoInter(Date dataInicial, Date dataFinal) { |
| 478 | for (String linha : getLinhas()) { |
478 | for (String linha : getLinhas()) { |
| 479 | Boolean adicionar = true; |
479 | Boolean adicionar = true; |
| 480 | String[] dadosSeparados = linha.split(";"); |
480 | String[] dadosSeparados = linha.split(";"); |
| 481 | Date dataLinha = DataUtil.retornarDataApartirString("dd/MM/yyyy - hh:mm:ss", dadosSeparados[1]); |
- | |
| - | 481 | Date dataLinha = DataUtil.retornarDataApartirString("dd/MM/yyyy - HH:mm:ss", dadosSeparados[1]); |
|
| 482 | if (DataUtils.dataEstaIgualOuEntrePeriodos(DataUtil.retornarDataFormatada("dd/MM/yyyy", dataLinha), dataInicial, dataFinal)) { |
482 | if (DataUtils.dataEstaIgualOuEntrePeriodos(DataUtil.retornarDataFormatada("dd/MM/yyyy", dataLinha), dataInicial, dataFinal)) { |
| 483 | if (indicadorVerificarMaquinetas) { |
483 | if (indicadorVerificarMaquinetas) { |
| 484 | if (!maquinetasSelecionadas.isEmpty()) { |
484 | if (!maquinetasSelecionadas.isEmpty()) { |
| 485 | for (Maquineta maquinetaSelecionada : maquinetasSelecionadas) { |
485 | for (Maquineta maquinetaSelecionada : maquinetasSelecionadas) { |
| 486 | adicionar = false; |
486 | adicionar = false; |
| Line 496... | Line 496... | ||
| 496 | CartaoDTO cartao = new CartaoDTO(); |
496 | CartaoDTO cartao = new CartaoDTO(); |
| 497 | cartao.setBandeira(StringUtil.setarUpperCaseComTrim(dadosSeparados[4])); |
497 | cartao.setBandeira(StringUtil.setarUpperCaseComTrim(dadosSeparados[4])); |
| 498 | FormaPagamento formaPagamento = null; |
498 | FormaPagamento formaPagamento = null; |
| 499 | String formaPag = StringUtil.setarUpperCaseComTrim(dadosSeparados[3]); |
499 | String formaPag = StringUtil.setarUpperCaseComTrim(dadosSeparados[3]); |
| 500 | String tipoCartao = null; |
500 | String tipoCartao = null; |
| 501 | if (formaPag.equals("DÉBITO") || formaPag.equals("D�BITO")) { |
- | |
| - | 501 | if (verificarSeEhDebito(formaPag)) { |
|
| 502 | tipoCartao = TipoCartao.DEBITO.getValor(); |
502 | tipoCartao = TipoCartao.DEBITO.getValor(); |
| 503 | formaPagamento = new FormaPagamento(ConstantesSEC.FormasDePagamento.FORMAPAGAMENTO_DEBITO); |
503 | formaPagamento = new FormaPagamento(ConstantesSEC.FormasDePagamento.FORMAPAGAMENTO_DEBITO); |
| 504 | if (cartao.getBandeira().equals("MASTERCARD")) { |
504 | if (cartao.getBandeira().equals("MASTERCARD")) { |
| 505 | cartao.setBandeira("MAESTRO"); |
505 | cartao.setBandeira("MAESTRO"); |
| 506 | }
|
506 | }
|
| 507 | } else { |
507 | } else { |
| 508 | tipoCartao = TipoCartao.CREDITO.getValor(); |
508 | tipoCartao = TipoCartao.CREDITO.getValor(); |
| 509 | String parcelas = StringUtil.setarUpperCaseComTrim(dadosSeparados[3]); |
509 | String parcelas = StringUtil.setarUpperCaseComTrim(dadosSeparados[3]); |
| 510 | if (parcelas.equals("À VISTA") || parcelas.equals("� VISTA")) { |
- | |
| - | 510 | if (verificarSeEhCreditoAvista(parcelas)) { |
|
| 511 | parcelas = "1"; |
511 | parcelas = "1"; |
| 512 | } else if (parcelas.contains("X")) { |
512 | } else if (parcelas.contains("X")) { |
| 513 | parcelas = parcelas.replaceAll("\\D+", ""); |
513 | parcelas = parcelas.replaceAll("\\D+", ""); |
| 514 | }
|
514 | }
|
| 515 | formaPagamento = new FormaPagamento(FormaPagamento.recuperarCodigoDaFormaDePagamento(parcelas)); |
515 | formaPagamento = new FormaPagamento(FormaPagamento.recuperarCodigoDaFormaDePagamento(parcelas)); |
| 516 | }
|
516 | }
|
| 517 | cartao.setBrutoImportado(new Double(dadosSeparados[7])); |
- | |
| - | 517 | cartao.setBrutoImportado(new Double(dadosSeparados[11])); |
|
| 518 | preencherDadosArquivo(dataLinha, cartao, formaPagamento, tipoCartao); |
518 | preencherDadosArquivo(dataLinha, cartao, formaPagamento, tipoCartao); |
| 519 | }
|
519 | }
|
| 520 | }
|
520 | }
|
| 521 | }
|
521 | }
|
| 522 | }
|
522 | }
|
| Line 548... | Line 548... | ||
| 548 | cartaoFormaDePagamento.setBandeira(vendaFormaPagamento.getBandeiraCartao()); |
548 | cartaoFormaDePagamento.setBandeira(vendaFormaPagamento.getBandeiraCartao()); |
| 549 | cartaoFormaDePagamento.setBruto(vendaFormaPagamento.getValorPagamento()); |
549 | cartaoFormaDePagamento.setBruto(vendaFormaPagamento.getValorPagamento()); |
| 550 | cartaoFormaDePagamento.setFormaPagamento(vendaFormaPagamento.getFormaPagamento()); |
550 | cartaoFormaDePagamento.setFormaPagamento(vendaFormaPagamento.getFormaPagamento()); |
| 551 | cartaoFormaDePagamento.setData(DataUtil.retornarDataFormatada("dd/MM/yyyy", vendaFormaPagamento.getVenda().getDataVenda())); |
551 | cartaoFormaDePagamento.setData(DataUtil.retornarDataFormatada("dd/MM/yyyy", vendaFormaPagamento.getVenda().getDataVenda())); |
| 552 | cartaoResumo.adicionarPagamento(cartaoFormaDePagamento); |
552 | cartaoResumo.adicionarPagamento(cartaoFormaDePagamento); |
| - | 553 | }
|
|
| - | 554 | ||
| - | 555 | private Boolean verificarSeEhDebito(String formaPagmento) { |
|
| - | 556 | String pagamento = StringUtil.setarUpperCaseComTrim(formaPagmento); |
|
| - | 557 | if (VerificadorUtil.naoEstaNuloOuVazio(formaPagmento)) { |
|
| - | 558 | if (pagamento.contains("DÉBITO") || pagamento.contains("D�BITO") || pagamento.contains("DéBITO")) { |
|
| - | 559 | return true; |
|
| - | 560 | }
|
|
| - | 561 | }
|
|
| - | 562 | return false; |
|
| - | 563 | }
|
|
| - | 564 | ||
| - | 565 | private Boolean verificarSeEhCreditoAvista(String parcelas) { |
|
| - | 566 | String pagamento = StringUtil.setarUpperCaseComTrim(parcelas); |
|
| - | 567 | if (VerificadorUtil.naoEstaNuloOuVazio(parcelas)) { |
|
| - | 568 | if (pagamento.contains("VISTA")) { |
|
| - | 569 | return true; |
|
| - | 570 | }
|
|
| - | 571 | }
|
|
| - | 572 | return false; |
|
| 553 | }
|
573 | }
|
| 554 | 574 | ||
| 555 | public void verificarLancamentos() { |
575 | public void verificarLancamentos() { |
| 556 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
576 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
| 557 | public void execute() { |
577 | public void execute() { |