Rev 463 | Rev 597 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 463 | Rev 596 | ||
|---|---|---|---|
| Line 238... | Line 238... | ||
| 238 | 238 | ||
| 239 | public void consultarComArquivo() { |
239 | public void consultarComArquivo() { |
| 240 | try { |
240 | try { |
| 241 | if (getTipoArquivoSelecionado().equals(ConstantesSEC.ArquivoBanco.ARQUIVO_BANCO_REDE_1)) { |
241 | if (getTipoArquivoSelecionado().equals(ConstantesSEC.ArquivoBanco.ARQUIVO_BANCO_REDE_1)) { |
| 242 | arquivoBancoRede(getCartaoResumoGeral().getDataInicialVendasSelecionada(), getCartaoResumoGeral().getDataFinalVendasSelecionada(), getMaquinetasSelecionadas(), getIndicadorVerificarMaquinetas()); |
242 | arquivoBancoRede(getCartaoResumoGeral().getDataInicialVendasSelecionada(), getCartaoResumoGeral().getDataFinalVendasSelecionada(), getMaquinetasSelecionadas(), getIndicadorVerificarMaquinetas()); |
| - | 243 | }
|
|
| - | 244 | if (getTipoArquivoSelecionado().equals(ConstantesSEC.ArquivoBanco.ARQUIVO_BANCO_CIELO_4)) { |
|
| - | 245 | arquivoBancoCielo(getCartaoResumoGeral().getDataInicialVendasSelecionada(), getCartaoResumoGeral().getDataFinalVendasSelecionada(), getMaquinetasSelecionadas(), getIndicadorVerificarMaquinetas()); |
|
| 243 | }
|
246 | }
|
| 244 | if (getTipoArquivoSelecionado().equals(ConstantesSEC.ArquivoBanco.ARQUIVO_BANCO_SAFRA_2)) { |
247 | if (getTipoArquivoSelecionado().equals(ConstantesSEC.ArquivoBanco.ARQUIVO_BANCO_SAFRA_2)) { |
| 245 | arquivoBancoSafra(getCartaoResumoGeral().getDataInicialVendasSelecionada(), getCartaoResumoGeral().getDataFinalVendasSelecionada()); |
248 | arquivoBancoSafra(getCartaoResumoGeral().getDataInicialVendasSelecionada(), getCartaoResumoGeral().getDataFinalVendasSelecionada()); |
| 246 | }
|
249 | }
|
| 247 | if (getTipoArquivoSelecionado().equals(ConstantesSEC.ArquivoBanco.ARQUIVO_BANCO_PAGSEGURO_3)) { |
250 | if (getTipoArquivoSelecionado().equals(ConstantesSEC.ArquivoBanco.ARQUIVO_BANCO_PAGSEGURO_3)) { |
| Line 311... | Line 314... | ||
| 311 | tipoCartao = TipoCartao.CREDITO.getValor(); |
314 | tipoCartao = TipoCartao.CREDITO.getValor(); |
| 312 | String parcelas = dadosSeparados[8]; |
315 | String parcelas = dadosSeparados[8]; |
| 313 | formaPagamento = new FormaPagamento(FormaPagamento.recuperarCodigoDaFormaDePagamento(parcelas)); |
316 | formaPagamento = new FormaPagamento(FormaPagamento.recuperarCodigoDaFormaDePagamento(parcelas)); |
| 314 | }
|
317 | }
|
| 315 | cartao.setBrutoImportado(new Double(dadosSeparados[3].replace(".", "").replace(",", "."))); |
318 | cartao.setBrutoImportado(new Double(dadosSeparados[3].replace(".", "").replace(",", "."))); |
| - | 319 | preencherDadosArquivo(dataLinha, cartao, formaPagamento, tipoCartao); |
|
| - | 320 | }
|
|
| - | 321 | }
|
|
| - | 322 | }
|
|
| - | 323 | }
|
|
| - | 324 | ||
| - | 325 | private void arquivoBancoCielo(Date dataInicial, Date dataFinal, List<Maquineta> maquinetasSelecionadas, Boolean indicadorVerificarMaquinetas) { |
|
| - | 326 | List<String> linhasRevisada = new ArrayList<String>(); |
|
| - | 327 | Boolean adicionar = false; |
|
| - | 328 | for (String linha : getLinhas()) { |
|
| - | 329 | if (adicionar) { |
|
| - | 330 | linhasRevisada.add(linha); |
|
| - | 331 | }
|
|
| - | 332 | if (linha.contains("Modalidade")) { |
|
| - | 333 | adicionar = true; |
|
| - | 334 | }
|
|
| - | 335 | }
|
|
| - | 336 | ||
| - | 337 | for (String linha : linhasRevisada) { |
|
| - | 338 | adicionar = true; |
|
| - | 339 | String[] dadosSeparados = linha.split(";"); |
|
| - | 340 | Date dataLinha = DataUtil.retornarDataApartirString("dd/MM/yyyy hh:mm", dadosSeparados[0] + " " + dadosSeparados[1]); |
|
| - | 341 | if (DataUtils.dataEstaIgualOuEntrePeriodos(DataUtil.retornarDataFormatada("dd/MM/yyyy", dataLinha), dataInicial, dataFinal)) { |
|
| - | 342 | if (indicadorVerificarMaquinetas) { |
|
| - | 343 | if (!maquinetasSelecionadas.isEmpty()) { |
|
| - | 344 | for (Maquineta maquinetaSelecionada : maquinetasSelecionadas) { |
|
| - | 345 | adicionar = false; |
|
| - | 346 | String maquineta = dadosSeparados[26]; |
|
| - | 347 | if (maquinetaSelecionada.getDescricao().equals(maquineta)) { |
|
| - | 348 | adicionar = true; |
|
| - | 349 | break; |
|
| - | 350 | }
|
|
| - | 351 | }
|
|
| - | 352 | }
|
|
| - | 353 | }
|
|
| - | 354 | if (adicionar) { |
|
| - | 355 | CartaoDTO cartao = new CartaoDTO(); |
|
| - | 356 | cartao.setBandeira(StringUtil.setarUpperCaseComTrim(dadosSeparados[4])); |
|
| - | 357 | FormaPagamento formaPagamento = null; |
|
| - | 358 | String bandeira = StringUtil.setarUpperCaseComTrim(dadosSeparados[9]); |
|
| - | 359 | String tipoCartao = null; |
|
| - | 360 | if (bandeira.equals("Venda débito")) { |
|
| - | 361 | tipoCartao = TipoCartao.DEBITO.getValor(); |
|
| - | 362 | formaPagamento = new FormaPagamento(ConstantesSEC.FormasDePagamento.FORMAPAGAMENTO_DEBITO); |
|
| - | 363 | if (cartao.getBandeira().equals("Mastercard")) { |
|
| - | 364 | cartao.setBandeira("MAESTRO"); |
|
| - | 365 | }
|
|
| - | 366 | } else if (!bandeira.equals("Venda Pix")) { |
|
| - | 367 | tipoCartao = TipoCartao.CREDITO.getValor(); |
|
| - | 368 | String parcelas = dadosSeparados[3]; |
|
| - | 369 | parcelas = parcelas.replace("Crédito parcelado loja ", "").replace("Crédito parcelado loja 0", "").replace("x", ""); |
|
| - | 370 | formaPagamento = new FormaPagamento(FormaPagamento.recuperarCodigoDaFormaDePagamento(parcelas)); |
|
| - | 371 | }
|
|
| - | 372 | cartao.setBrutoImportado(new Double(dadosSeparados[5].replace(".", "").replace(",", "."))); |
|
| 316 | preencherDadosArquivo(dataLinha, cartao, formaPagamento, tipoCartao); |
373 | preencherDadosArquivo(dataLinha, cartao, formaPagamento, tipoCartao); |
| 317 | }
|
374 | }
|
| 318 | }
|
375 | }
|
| 319 | }
|
376 | }
|
| 320 | }
|
377 | }
|