Rev 675 | Details | Compare with Previous | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 106 | espaco | 1 | package br.com.ec.controller.managedbean; |
| 2 | |||
| 3 | import java.io.BufferedReader; |
||
| 4 | import java.io.IOException; |
||
| 5 | import java.io.InputStreamReader; |
||
| 6 | import java.io.Serializable; |
||
| 7 | import java.util.ArrayList; |
||
| 8 | import java.util.Calendar; |
||
| 9 | import java.util.Date; |
||
| 10 | import java.util.List; |
||
| 11 | |||
| 12 | import javax.inject.Inject; |
||
| 13 | import javax.inject.Named; |
||
| 14 | |||
| 15 | import org.apache.commons.lang.time.DateUtils; |
||
| 16 | import org.primefaces.event.FileUploadEvent; |
||
| 17 | import org.primefaces.model.UploadedFile; |
||
| 18 | import org.springframework.context.annotation.Scope; |
||
| 19 | |||
| 195 | espaco | 20 | import br.com.ec.core.exception.NegocioException; |
| 21 | import br.com.ec.core.generic.GenericService; |
||
| 22 | import br.com.ec.core.util.DataUtils; |
||
| 23 | import br.com.ec.core.util.StringUtil; |
||
| 24 | import br.com.ec.core.util.VerificadorUtil; |
||
| 106 | espaco | 25 | import br.com.ec.domain.dto.CartaoBandeiraDTO; |
| 26 | import br.com.ec.domain.dto.CartaoDTO; |
||
| 27 | import br.com.ec.domain.dto.CartaoDataDTO; |
||
| 28 | import br.com.ec.domain.dto.CartaoResumoDTO; |
||
| 29 | import br.com.ec.domain.dto.CartaoResumoGeralDTO; |
||
| 30 | import br.com.ec.domain.model.FormaPagamento; |
||
| 31 | import br.com.ec.domain.model.Maquineta; |
||
| 32 | import br.com.ec.domain.model.VendaFormaPagamento; |
||
| 33 | import br.com.ec.domain.model.tipos.TipoCartao; |
||
| 34 | import br.com.ec.domain.service.bandeiracartao.BandeiraCartaoService; |
||
| 35 | import br.com.ec.domain.service.formapagamento.FormaPagamentoService; |
||
| 36 | import br.com.ec.domain.service.parcela.ParcelaService; |
||
| 37 | import br.com.ec.domain.service.vendaformapagamento.VendaFormaPagamentoService; |
||
| 38 | import br.com.ec.domain.shared.ConstantesSEC; |
||
| 39 | import br.com.ec.domain.shared.Ordenador; |
||
| 40 | import br.com.ec.domain.shared.OrdenadorImpl; |
||
| 195 | espaco | 41 | import br.com.ec.web.exception.VerificadorLancamentoException; |
| 42 | import br.com.ec.web.exception.VerificadorLancamentoException.CommandBean; |
||
| 43 | import br.com.ec.web.generic.AbstractBean; |
||
| 44 | import br.com.ec.web.message.LancadorMensagem; |
||
| 45 | import br.com.ec.web.util.DataUtil; |
||
| 106 | espaco | 46 | |
| 47 | @Named |
||
| 48 | @Scope("view") |
||
| 49 | public class CartoesGerenciadorBean extends AbstractBean<CartaoDTO> implements Serializable { |
||
| 50 | |||
| 51 | private static final long serialVersionUID = 1L; |
||
| 52 | |||
| 53 | private ParcelaService parcelaService; |
||
| 54 | private VendaFormaPagamentoService vendaFormaPagamentoService; |
||
| 55 | private BandeiraCartaoService bandeiraCartaoService; |
||
| 56 | private FormaPagamentoService formaPagamentoService; |
||
| 57 | |||
| 58 | private List<CartaoDTO> cartoes; |
||
| 59 | private List<CartaoDTO> cartoesGerados; |
||
| 60 | private CartaoResumoGeralDTO cartaoResumoGeral; |
||
| 61 | private CartaoResumoDTO cartaoResumo; |
||
| 62 | |||
| 63 | private Date dataVendas; |
||
| 64 | private List<VendaFormaPagamento> listaVendaFormaPagamento; |
||
| 65 | private List<CartaoDataDTO> listaDatas; |
||
| 66 | |||
| 67 | private List<Maquineta> maquinetasSelecionadas; |
||
| 68 | private Boolean indicadorVerificarMaquinetas = false; |
||
| 69 | private String tipoArquivoSelecionado = ConstantesSEC.ArquivoBanco.ARQUIVO_BANCO_REDE_1; |
||
| 70 | |||
| 71 | private List<String> linhas; |
||
| 72 | private UploadedFile arquivoParaUpload; |
||
| 73 | private Ordenador ordenador; |
||
| 74 | |||
| 75 | @Inject |
||
| 76 | public CartoesGerenciadorBean(ParcelaService parcelaService, VendaFormaPagamentoService vendaFormaPagamentoService, |
||
| 77 | BandeiraCartaoService bandeiraCartaoService, FormaPagamentoService formaPagamentoService) { |
||
| 78 | this.parcelaService = parcelaService; |
||
| 79 | this.vendaFormaPagamentoService = vendaFormaPagamentoService; |
||
| 80 | this.bandeiraCartaoService = bandeiraCartaoService; |
||
| 81 | this.formaPagamentoService = formaPagamentoService; |
||
| 82 | this.ordenador = new OrdenadorImpl(); |
||
| 83 | } |
||
| 84 | |||
| 85 | @Override |
||
| 86 | public void preCarregamento() { |
||
| 87 | setDataVendas(DataUtils.getDataAtual()); |
||
| 88 | setCartaoResumoGeral(new CartaoResumoGeralDTO()); |
||
| 89 | } |
||
| 90 | |||
| 91 | @Override |
||
| 92 | public void limparEntidade() { |
||
| 93 | setEntidade(new CartaoDTO()); |
||
| 94 | setCartoes(null); |
||
| 95 | setCartoesGerados(null); |
||
| 96 | setCartaoResumo(null); |
||
| 97 | } |
||
| 98 | |||
| 99 | @Override |
||
| 100 | public GenericService<CartaoDTO> getService() { |
||
| 101 | return null; |
||
| 102 | } |
||
| 103 | |||
| 104 | @Override |
||
| 105 | public CartaoDTO getEntidade() { |
||
| 106 | return entidade; |
||
| 107 | } |
||
| 108 | |||
| 109 | @Override |
||
| 110 | public CartaoDTO getId() { |
||
| 111 | return getEntidade(); |
||
| 112 | } |
||
| 113 | |||
| 114 | public List<CartaoDTO> getCartoes() { |
||
| 115 | return cartoes; |
||
| 116 | } |
||
| 117 | public void setCartoes(List<CartaoDTO> cartoes) { |
||
| 118 | this.cartoes = cartoes; |
||
| 119 | } |
||
| 120 | |||
| 121 | public List<CartaoDTO> getCartoesGerados() { |
||
| 122 | return cartoesGerados; |
||
| 123 | } |
||
| 124 | public void setCartoesGerados(List<CartaoDTO> cartoesGerados) { |
||
| 125 | this.cartoesGerados = cartoesGerados; |
||
| 126 | } |
||
| 127 | |||
| 128 | public CartaoResumoGeralDTO getCartaoResumoGeral() { |
||
| 129 | return cartaoResumoGeral; |
||
| 130 | } |
||
| 131 | public void setCartaoResumoGeral(CartaoResumoGeralDTO cartaoResumoGeral) { |
||
| 132 | this.cartaoResumoGeral = cartaoResumoGeral; |
||
| 133 | } |
||
| 134 | |||
| 135 | public CartaoResumoDTO getCartaoResumo() { |
||
| 136 | return cartaoResumo; |
||
| 137 | } |
||
| 138 | public void setCartaoResumo(CartaoResumoDTO cartaoResumo) { |
||
| 139 | this.cartaoResumo = cartaoResumo; |
||
| 140 | } |
||
| 141 | |||
| 142 | public Date getDataVendas() { |
||
| 143 | return dataVendas; |
||
| 144 | } |
||
| 145 | public void setDataVendas(Date dataVendas) { |
||
| 146 | this.dataVendas = dataVendas; |
||
| 147 | } |
||
| 148 | |||
| 149 | public List<VendaFormaPagamento> getListaVendaFormaPagamento() { |
||
| 150 | return listaVendaFormaPagamento; |
||
| 151 | } |
||
| 152 | public void setListaVendaFormaPagamento(List<VendaFormaPagamento> listaVendaFormaPagamento) { |
||
| 153 | this.listaVendaFormaPagamento = listaVendaFormaPagamento; |
||
| 154 | } |
||
| 155 | |||
| 156 | public List<CartaoDataDTO> getListaDatas() { |
||
| 157 | return listaDatas; |
||
| 158 | } |
||
| 159 | public void setListaDatas(List<CartaoDataDTO> listaDatas) { |
||
| 160 | this.listaDatas = listaDatas; |
||
| 161 | } |
||
| 162 | |||
| 163 | public List<Maquineta> getMaquinetasSelecionadas() { |
||
| 164 | return maquinetasSelecionadas; |
||
| 165 | } |
||
| 166 | public void setMaquinetasSelecionadas(List<Maquineta> maquinetasSelecionadas) { |
||
| 167 | this.maquinetasSelecionadas = maquinetasSelecionadas; |
||
| 168 | } |
||
| 169 | public String maquinetasSelecionadasDescricao() { |
||
| 170 | String descricao = ""; |
||
| 171 | for (Maquineta m : getMaquinetasSelecionadas()) { |
||
| 172 | descricao = descricao + m.getEmpresaAdquirente().getDescricao() + ": " + m.getDescricao() + "; "; |
||
| 173 | } |
||
| 174 | return descricao; |
||
| 175 | } |
||
| 176 | |||
| 177 | public Boolean getIndicadorVerificarMaquinetas() { |
||
| 178 | return indicadorVerificarMaquinetas; |
||
| 179 | } |
||
| 180 | public void setIndicadorVerificarMaquinetas(Boolean indicadorVerificarMaquinetas) { |
||
| 181 | this.indicadorVerificarMaquinetas = indicadorVerificarMaquinetas; |
||
| 182 | } |
||
| 183 | |||
| 184 | public String getTipoArquivoSelecionado() { |
||
| 185 | return tipoArquivoSelecionado; |
||
| 186 | } |
||
| 187 | public void setTipoArquivoSelecionado(String tipoArquivoSelecionado) { |
||
| 188 | this.tipoArquivoSelecionado = tipoArquivoSelecionado; |
||
| 189 | } |
||
| 190 | |||
| 191 | public List<String> getLinhas() { |
||
| 192 | return linhas; |
||
| 193 | } |
||
| 194 | public void setLinhas(List<String> linhas) { |
||
| 195 | this.linhas = linhas; |
||
| 196 | } |
||
| 197 | |||
| 198 | public UploadedFile getArquivoParaUpload() { |
||
| 199 | return arquivoParaUpload; |
||
| 200 | } |
||
| 201 | public void setArquivoParaUpload(UploadedFile arquivoParaUpload) { |
||
| 202 | this.arquivoParaUpload = arquivoParaUpload; |
||
| 203 | } |
||
| 204 | |||
| 205 | public void atualizarConsultaComArquivo() { |
||
| 206 | limparEntidade(); |
||
| 207 | cartaoResumo = new CartaoResumoDTO(); |
||
| 208 | consultarComArquivo(); |
||
| 209 | } |
||
| 210 | |||
| 211 | public void uploadArquivoCsv(final FileUploadEvent e) { |
||
| 212 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 213 | public void execute() { |
||
| 214 | limparEntidade(); |
||
| 215 | BufferedReader reader = null; |
||
| 216 | List<String> linhas = new ArrayList<String>(); |
||
| 217 | try { |
||
| 218 | reader = new BufferedReader(new InputStreamReader(e.getFile().getInputstream())); |
||
| 219 | String linha = reader.readLine(); |
||
| 220 | cartaoResumo = new CartaoResumoDTO(); |
||
| 221 | while ((linha = reader.readLine()) != null) { |
||
| 222 | linhas.add(linha); |
||
| 223 | } |
||
| 224 | } catch (Exception ex) { |
||
| 225 | ex.printStackTrace(); |
||
| 226 | } finally { |
||
| 227 | try { |
||
| 228 | reader.close(); |
||
| 229 | } catch (IOException exc) { |
||
| 230 | exc.printStackTrace(); |
||
| 231 | } |
||
| 232 | } |
||
| 233 | setLinhas(linhas); |
||
| 234 | consultarComArquivo(); |
||
| 235 | } |
||
| 236 | }); |
||
| 237 | } |
||
| 238 | |||
| 239 | public void consultarComArquivo() { |
||
| 240 | try { |
||
| 241 | if (getTipoArquivoSelecionado().equals(ConstantesSEC.ArquivoBanco.ARQUIVO_BANCO_REDE_1)) { |
||
| 242 | arquivoBancoRede(getCartaoResumoGeral().getDataInicialVendasSelecionada(), getCartaoResumoGeral().getDataFinalVendasSelecionada(), getMaquinetasSelecionadas(), getIndicadorVerificarMaquinetas()); |
||
| 243 | } |
||
| 596 | blopes | 244 | if (getTipoArquivoSelecionado().equals(ConstantesSEC.ArquivoBanco.ARQUIVO_BANCO_CIELO_4)) { |
| 245 | arquivoBancoCielo(getCartaoResumoGeral().getDataInicialVendasSelecionada(), getCartaoResumoGeral().getDataFinalVendasSelecionada(), getMaquinetasSelecionadas(), getIndicadorVerificarMaquinetas()); |
||
| 246 | } |
||
| 106 | espaco | 247 | if (getTipoArquivoSelecionado().equals(ConstantesSEC.ArquivoBanco.ARQUIVO_BANCO_SAFRA_2)) { |
| 248 | arquivoBancoSafra(getCartaoResumoGeral().getDataInicialVendasSelecionada(), getCartaoResumoGeral().getDataFinalVendasSelecionada()); |
||
| 249 | } |
||
| 293 | espaco | 250 | if (getTipoArquivoSelecionado().equals(ConstantesSEC.ArquivoBanco.ARQUIVO_BANCO_PAGSEGURO_3)) { |
| 251 | arquivoBancoPagseguro(getCartaoResumoGeral().getDataInicialVendasSelecionada(), getCartaoResumoGeral().getDataFinalVendasSelecionada()); |
||
| 252 | } |
||
| 674 | blopes | 253 | if (getTipoArquivoSelecionado().equals(ConstantesSEC.ArquivoBanco.ARQUIVO_BANCO_INTER_5)) { |
| 675 | blopes | 254 | arquivoBancoInter(getCartaoResumoGeral().getDataInicialVendasSelecionada(), getCartaoResumoGeral().getDataFinalVendasSelecionada()); |
| 674 | blopes | 255 | } |
| 106 | espaco | 256 | setListaVendaFormaPagamento(vendaFormaPagamentoService.consultarLancamentosCartoesNoPeriodo(getCartaoResumoGeral().getDataInicialVendasSelecionada(), getCartaoResumoGeral().getDataFinalVendasSelecionada(), null, getMaquinetasSelecionadas())); |
| 257 | for (VendaFormaPagamento vendaFormaPagamento : getListaVendaFormaPagamento()) { |
||
| 258 | if (VerificadorUtil.estaNulo(vendaFormaPagamento.getCupom())) { |
||
| 259 | preencherDados(vendaFormaPagamento); |
||
| 260 | } |
||
| 261 | } |
||
| 262 | |||
| 263 | List<CartaoResumoDTO> resumosPorDia = new ArrayList<CartaoResumoDTO>(); |
||
| 264 | Date dataSelecionada = getCartaoResumoGeral().getDataInicialVendasSelecionada(); |
||
| 265 | while (DataUtils.dataEstaIgualOuEntrePeriodos(dataSelecionada, DataUtils.getDataComHorarioMinimo(getCartaoResumoGeral().getDataInicialVendasSelecionada()), DataUtils.getDataComHorarioMinimo(getCartaoResumoGeral().getDataFinalVendasSelecionada()))) { |
||
| 266 | CartaoResumoDTO resumoPorDia = new CartaoResumoDTO(); |
||
| 267 | resumoPorDia.setDataResumo(dataSelecionada); |
||
| 268 | for (CartaoBandeiraDTO cartaoPorBandeira : cartaoResumo.getCartoesPorBandeira()) { |
||
| 269 | if (DataUtils.dataEstaIgualOuEntrePeriodos(cartaoPorBandeira.getData(), DataUtils.getDataComHorarioMinimo(dataSelecionada), DataUtils.getDataComHorarioMaximo(dataSelecionada))) { |
||
| 270 | resumoPorDia.getCartoesPorBandeira().add(cartaoPorBandeira); |
||
| 271 | } |
||
| 272 | } |
||
| 273 | dataSelecionada = DataUtils.acrescentarDias(dataSelecionada, 1); |
||
| 274 | resumoPorDia.somarValores(); |
||
| 275 | resumosPorDia.add(resumoPorDia); |
||
| 276 | } |
||
| 277 | cartaoResumo.setCartoesPorBandeira((List<CartaoBandeiraDTO>) ordenador.ordenar(cartaoResumo.getCartoesPorBandeira())); |
||
| 278 | getCartaoResumoGeral().setCartoesResumo(resumosPorDia); |
||
| 279 | } catch (Exception e) { |
||
| 280 | throw new NegocioException(e.getMessage()); |
||
| 281 | } finally { |
||
| 282 | cartaoResumo.setCartoesPorBandeira((List<CartaoBandeiraDTO>) ordenador.ordenar(cartaoResumo.getCartoesPorBandeira())); |
||
| 283 | } |
||
| 284 | } |
||
| 285 | |||
| 286 | private void arquivoBancoRede(Date dataInicial, Date dataFinal, List<Maquineta> maquinetasSelecionadas, Boolean indicadorVerificarMaquinetas) { |
||
| 287 | for (String linha : getLinhas()) { |
||
| 288 | Boolean adicionar = true; |
||
| 289 | String[] dadosSeparados = linha.split(";"); |
||
| 290 | Date dataLinha = DataUtil.retornarDataApartirString("dd/MM/yyyy hh:mm:ss", dadosSeparados[0] + " " + dadosSeparados[1]); |
||
| 291 | if (DataUtils.dataEstaIgualOuEntrePeriodos(DataUtil.retornarDataFormatada("dd/MM/yyyy", dataLinha), dataInicial, dataFinal)) { |
||
| 292 | if (indicadorVerificarMaquinetas) { |
||
| 293 | if (!maquinetasSelecionadas.isEmpty()) { |
||
| 294 | for (Maquineta maquinetaSelecionada : maquinetasSelecionadas) { |
||
| 295 | adicionar = false; |
||
| 296 | String maquineta = dadosSeparados[19]; |
||
| 297 | if (maquinetaSelecionada.getDescricao().equals(maquineta)) { |
||
| 298 | adicionar = true; |
||
| 299 | break; |
||
| 300 | } |
||
| 301 | } |
||
| 302 | } |
||
| 303 | } |
||
| 304 | if (adicionar) { |
||
| 305 | CartaoDTO cartao = new CartaoDTO(); |
||
| 463 | blopes | 306 | cartao.setBandeira(StringUtil.setarUpperCaseComTrim(dadosSeparados[9])); |
| 106 | espaco | 307 | FormaPagamento formaPagamento = null; |
| 318 | espaco | 308 | String bandeira = StringUtil.setarUpperCaseComTrim(dadosSeparados[5]); |
| 106 | espaco | 309 | String tipoCartao = null; |
| 675 | blopes | 310 | if (verificarSeEhDebito(bandeira)) { |
| 106 | espaco | 311 | tipoCartao = TipoCartao.DEBITO.getValor(); |
| 312 | formaPagamento = new FormaPagamento(ConstantesSEC.FormasDePagamento.FORMAPAGAMENTO_DEBITO); |
||
| 313 | if (cartao.getBandeira().equals("MASTERCARD")) { |
||
| 314 | cartao.setBandeira("MAESTRO"); |
||
| 315 | } |
||
| 316 | } else { |
||
| 317 | tipoCartao = TipoCartao.CREDITO.getValor(); |
||
| 463 | blopes | 318 | String parcelas = dadosSeparados[8]; |
| 106 | espaco | 319 | formaPagamento = new FormaPagamento(FormaPagamento.recuperarCodigoDaFormaDePagamento(parcelas)); |
| 320 | } |
||
| 330 | espaco | 321 | cartao.setBrutoImportado(new Double(dadosSeparados[3].replace(".", "").replace(",", "."))); |
| 106 | espaco | 322 | preencherDadosArquivo(dataLinha, cartao, formaPagamento, tipoCartao); |
| 323 | } |
||
| 324 | } |
||
| 325 | } |
||
| 326 | } |
||
| 327 | |||
| 596 | blopes | 328 | private void arquivoBancoCielo(Date dataInicial, Date dataFinal, List<Maquineta> maquinetasSelecionadas, Boolean indicadorVerificarMaquinetas) { |
| 329 | List<String> linhasRevisada = new ArrayList<String>(); |
||
| 330 | Boolean adicionar = false; |
||
| 331 | for (String linha : getLinhas()) { |
||
| 332 | if (adicionar) { |
||
| 333 | linhasRevisada.add(linha); |
||
| 334 | } |
||
| 335 | if (linha.contains("Modalidade")) { |
||
| 336 | adicionar = true; |
||
| 337 | } |
||
| 597 | blopes | 338 | } |
| 596 | blopes | 339 | |
| 340 | for (String linha : linhasRevisada) { |
||
| 341 | adicionar = true; |
||
| 342 | String[] dadosSeparados = linha.split(";"); |
||
| 343 | Date dataLinha = DataUtil.retornarDataApartirString("dd/MM/yyyy hh:mm", dadosSeparados[0] + " " + dadosSeparados[1]); |
||
| 344 | if (DataUtils.dataEstaIgualOuEntrePeriodos(DataUtil.retornarDataFormatada("dd/MM/yyyy", dataLinha), dataInicial, dataFinal)) { |
||
| 345 | if (indicadorVerificarMaquinetas) { |
||
| 346 | if (!maquinetasSelecionadas.isEmpty()) { |
||
| 347 | for (Maquineta maquinetaSelecionada : maquinetasSelecionadas) { |
||
| 348 | adicionar = false; |
||
| 349 | String maquineta = dadosSeparados[26]; |
||
| 350 | if (maquinetaSelecionada.getDescricao().equals(maquineta)) { |
||
| 351 | adicionar = true; |
||
| 352 | break; |
||
| 353 | } |
||
| 354 | } |
||
| 355 | } |
||
| 356 | } |
||
| 357 | if (adicionar) { |
||
| 608 | blopes | 358 | try { |
| 359 | CartaoDTO cartao = new CartaoDTO(); |
||
| 360 | cartao.setBandeira(StringUtil.setarUpperCaseComTrim(dadosSeparados[4])); |
||
| 361 | FormaPagamento formaPagamento = null; |
||
| 362 | String bandeira = StringUtil.setarUpperCaseComTrim(dadosSeparados[9]); |
||
| 363 | String tipoCartao = null; |
||
| 364 | String parcelas = null; |
||
| 613 | blopes | 365 | if (bandeira.contains("VENDA D")) { |
| 608 | blopes | 366 | tipoCartao = TipoCartao.DEBITO.getValor(); |
| 367 | formaPagamento = new FormaPagamento(ConstantesSEC.FormasDePagamento.FORMAPAGAMENTO_DEBITO); |
||
| 368 | if (cartao.getBandeira().equals("MASTERCARD")) { |
||
| 369 | cartao.setBandeira("MAESTRO"); |
||
| 370 | } |
||
| 371 | } else if (!bandeira.equals("VENDA PIX")) { |
||
| 372 | tipoCartao = TipoCartao.CREDITO.getValor(); |
||
| 613 | blopes | 373 | parcelas = StringUtil.setarUpperCaseComTrim(dadosSeparados[3]); |
| 374 | if (parcelas.contains("VISTA") || parcelas.contains("PARCELADO BANCO") || parcelas.contains("CONVERSOR DE MOEDAS") || parcelas.contains("-PAGO")) { |
||
| 608 | blopes | 375 | parcelas = "1"; |
| 613 | blopes | 376 | } else if (parcelas.contains("PARCELADO")) { |
| 377 | parcelas = parcelas.substring(parcelas.indexOf("LOJA")); |
||
| 378 | parcelas = parcelas.replace("LOJA 0", "").replace("LOJA ", "").replace("X", ""); |
||
| 608 | blopes | 379 | } |
| 380 | formaPagamento = new FormaPagamento(FormaPagamento.recuperarCodigoDaFormaDePagamento(parcelas)); |
||
| 597 | blopes | 381 | } |
| 608 | blopes | 382 | if (VerificadorUtil.naoEstaNulo(formaPagamento)) { |
| 383 | String valorBruto = dadosSeparados[5].replace(".", "").replace(",", "."); |
||
| 384 | if (valorBruto.contains("R$")) { |
||
| 385 | valorBruto = valorBruto.substring(3); |
||
| 386 | } |
||
| 387 | cartao.setBrutoImportado(new Double(valorBruto)); |
||
| 388 | preencherDadosArquivo(dataLinha, cartao, formaPagamento, tipoCartao); |
||
| 389 | } |
||
| 390 | } catch (Exception e) { |
||
| 391 | throw new NegocioException("ERRO NA IDENTIFICAÇÃO DOS LANÇAMENTOS"); |
||
| 392 | } |
||
| 596 | blopes | 393 | } |
| 394 | } |
||
| 395 | } |
||
| 396 | } |
||
| 397 | |||
| 106 | espaco | 398 | private void arquivoBancoSafra(Date dataInicial, Date dataFinal) { |
| 399 | for (String linha : getLinhas()) { |
||
| 400 | String[] dadosSeparados = linha.split(";"); |
||
| 675 | blopes | 401 | Date dataLinha = DataUtil.retornarDataApartirString("dd/MM/yyyy HH.mm.ss", dadosSeparados[4] + " " + dadosSeparados[5]); |
| 106 | espaco | 402 | if (DataUtils.dataEstaIgualOuEntrePeriodos(DataUtil.retornarDataFormatada("dd/MM/yyyy", dataLinha), dataInicial, dataFinal)) { |
| 403 | CartaoDTO cartao = new CartaoDTO(); |
||
| 404 | cartao.setBandeira(StringUtil.setarUpperCaseComTrim(dadosSeparados[7])); |
||
| 405 | FormaPagamento formaPagamento = null; |
||
| 406 | String bandeira = StringUtil.setarUpperCaseComTrim(dadosSeparados[9]); |
||
| 407 | String tipoCartao = null; |
||
| 408 | if (bandeira.equals("00")) { |
||
| 409 | tipoCartao = TipoCartao.DEBITO.getValor(); |
||
| 410 | formaPagamento = new FormaPagamento(ConstantesSEC.FormasDePagamento.FORMAPAGAMENTO_DEBITO); |
||
| 411 | if (cartao.getBandeira().equals("MASTERCARD")) { |
||
| 412 | cartao.setBandeira("MAESTRO"); |
||
| 413 | } |
||
| 414 | } else { |
||
| 415 | String parcelas = ""; |
||
| 416 | if (bandeira.substring(0, 1).equals("0")) { |
||
| 417 | parcelas = dadosSeparados[9].substring(1); |
||
| 418 | } else { |
||
| 419 | parcelas = dadosSeparados[9]; |
||
| 420 | } |
||
| 421 | tipoCartao = TipoCartao.CREDITO.getValor(); |
||
| 422 | formaPagamento = new FormaPagamento(FormaPagamento.recuperarCodigoDaFormaDePagamento(parcelas)); |
||
| 423 | } |
||
| 424 | cartao.setBrutoImportado(new Double(dadosSeparados[11].replace(".", "").replace(",", "."))); |
||
| 425 | preencherDadosArquivo(dataLinha, cartao, formaPagamento, tipoCartao); |
||
| 426 | } |
||
| 427 | } |
||
| 428 | } |
||
| 293 | espaco | 429 | |
| 430 | private void arquivoBancoPagseguro(Date dataInicial, Date dataFinal) { |
||
| 431 | for (String linha : getLinhas()) { |
||
| 432 | Boolean adicionar = true; |
||
| 433 | String[] dadosSeparados = linha.split(";"); |
||
| 434 | Date dataLinha = DataUtil.retornarDataApartirString("dd/MM/yyyy hh:mm", dadosSeparados[2]); |
||
| 435 | if (DataUtils.dataEstaIgualOuEntrePeriodos(DataUtil.retornarDataFormatada("dd/MM/yyyy", dataLinha), dataInicial, dataFinal)) { |
||
| 436 | if (indicadorVerificarMaquinetas) { |
||
| 437 | if (!maquinetasSelecionadas.isEmpty()) { |
||
| 438 | for (Maquineta maquinetaSelecionada : maquinetasSelecionadas) { |
||
| 439 | adicionar = false; |
||
| 440 | String maquineta = dadosSeparados[3]; |
||
| 441 | if (maquinetaSelecionada.getDescricao().equals(maquineta)) { |
||
| 442 | adicionar = true; |
||
| 443 | break; |
||
| 444 | } |
||
| 445 | } |
||
| 446 | } |
||
| 447 | } |
||
| 448 | if (adicionar) { |
||
| 449 | CartaoDTO cartao = new CartaoDTO(); |
||
| 450 | cartao.setBandeira(StringUtil.setarUpperCaseComTrim(dadosSeparados[5])); |
||
| 451 | FormaPagamento formaPagamento = null; |
||
| 452 | String bandeira = StringUtil.setarUpperCaseComTrim(dadosSeparados[4]); |
||
| 453 | String tipoCartao = null; |
||
| 675 | blopes | 454 | if (verificarSeEhDebito(bandeira)) { |
| 293 | espaco | 455 | tipoCartao = TipoCartao.DEBITO.getValor(); |
| 456 | formaPagamento = new FormaPagamento(ConstantesSEC.FormasDePagamento.FORMAPAGAMENTO_DEBITO); |
||
| 313 | espaco | 457 | if (cartao.getBandeira().equals("MasterCard") || cartao.getBandeira().equals("MASTERCARD")) { |
| 293 | espaco | 458 | cartao.setBandeira("MAESTRO"); |
| 459 | } |
||
| 460 | } else { |
||
| 461 | tipoCartao = TipoCartao.CREDITO.getValor(); |
||
| 675 | blopes | 462 | String parcelas = StringUtil.setarUpperCaseComTrim(dadosSeparados[6]); |
| 463 | if (verificarSeEhCreditoAvista(parcelas)) { |
||
| 293 | espaco | 464 | parcelas = "1"; |
| 675 | blopes | 465 | } else if (parcelas.equals("PARCELADO")) { |
| 313 | espaco | 466 | parcelas = "2"; |
| 293 | espaco | 467 | } |
| 468 | formaPagamento = new FormaPagamento(FormaPagamento.recuperarCodigoDaFormaDePagamento(parcelas)); |
||
| 469 | } |
||
| 470 | cartao.setBrutoImportado(new Double(dadosSeparados[7])); |
||
| 471 | preencherDadosArquivo(dataLinha, cartao, formaPagamento, tipoCartao); |
||
| 472 | } |
||
| 473 | } |
||
| 474 | } |
||
| 475 | } |
||
| 674 | blopes | 476 | |
| 477 | private void arquivoBancoInter(Date dataInicial, Date dataFinal) { |
||
| 478 | for (String linha : getLinhas()) { |
||
| 479 | Boolean adicionar = true; |
||
| 480 | String[] dadosSeparados = linha.split(";"); |
||
| 675 | blopes | 481 | Date dataLinha = DataUtil.retornarDataApartirString("dd/MM/yyyy - HH:mm:ss", dadosSeparados[1]); |
| 674 | blopes | 482 | if (DataUtils.dataEstaIgualOuEntrePeriodos(DataUtil.retornarDataFormatada("dd/MM/yyyy", dataLinha), dataInicial, dataFinal)) { |
| 483 | if (indicadorVerificarMaquinetas) { |
||
| 484 | if (!maquinetasSelecionadas.isEmpty()) { |
||
| 485 | for (Maquineta maquinetaSelecionada : maquinetasSelecionadas) { |
||
| 486 | adicionar = false; |
||
| 487 | String maquineta = dadosSeparados[2]; |
||
| 488 | if (maquinetaSelecionada.getDescricao().equals(maquineta)) { |
||
| 489 | adicionar = true; |
||
| 490 | break; |
||
| 491 | } |
||
| 492 | } |
||
| 493 | } |
||
| 494 | } |
||
| 495 | if (adicionar) { |
||
| 496 | CartaoDTO cartao = new CartaoDTO(); |
||
| 497 | cartao.setBandeira(StringUtil.setarUpperCaseComTrim(dadosSeparados[4])); |
||
| 498 | FormaPagamento formaPagamento = null; |
||
| 499 | String formaPag = StringUtil.setarUpperCaseComTrim(dadosSeparados[3]); |
||
| 500 | String tipoCartao = null; |
||
| 675 | blopes | 501 | if (verificarSeEhDebito(formaPag)) { |
| 674 | blopes | 502 | tipoCartao = TipoCartao.DEBITO.getValor(); |
| 503 | formaPagamento = new FormaPagamento(ConstantesSEC.FormasDePagamento.FORMAPAGAMENTO_DEBITO); |
||
| 504 | if (cartao.getBandeira().equals("MASTERCARD")) { |
||
| 505 | cartao.setBandeira("MAESTRO"); |
||
| 506 | } |
||
| 507 | } else { |
||
| 508 | tipoCartao = TipoCartao.CREDITO.getValor(); |
||
| 509 | String parcelas = StringUtil.setarUpperCaseComTrim(dadosSeparados[3]); |
||
| 675 | blopes | 510 | if (verificarSeEhCreditoAvista(parcelas)) { |
| 674 | blopes | 511 | parcelas = "1"; |
| 512 | } else if (parcelas.contains("X")) { |
||
| 513 | parcelas = parcelas.replaceAll("\\D+", ""); |
||
| 514 | } |
||
| 515 | formaPagamento = new FormaPagamento(FormaPagamento.recuperarCodigoDaFormaDePagamento(parcelas)); |
||
| 516 | } |
||
| 680 | blopes | 517 | Double valorBruto = new Double(0.0); |
| 518 | if (VerificadorUtil.naoEstaNuloOuVazio(dadosSeparados[11])) { |
||
| 519 | String valorLinha = dadosSeparados[11].replace("R$", "").trim(); |
||
| 520 | valorBruto = new Double(valorLinha.replace(".", "").replace(",", ".").replace("\"", "")); |
||
| 521 | } |
||
| 522 | cartao.setBrutoImportado(valorBruto); |
||
| 674 | blopes | 523 | preencherDadosArquivo(dataLinha, cartao, formaPagamento, tipoCartao); |
| 524 | } |
||
| 525 | } |
||
| 526 | } |
||
| 527 | } |
||
| 106 | espaco | 528 | |
| 529 | private void preencherDadosArquivo(Date data, CartaoDTO cartao, FormaPagamento formaPagamento, String tipoCartao) { |
||
| 530 | cartao.setFormaDePagamento(formaPagamentoService.consultarPorId(formaPagamento)); |
||
| 531 | if (VerificadorUtil.naoEstaNulo(cartao.getBandeira())) { |
||
| 532 | if (cartao.getBandeira().equals("AMEX")) { |
||
| 533 | cartao.setBandeira("AMERICAN EXPRESS"); |
||
| 534 | } |
||
| 535 | if (cartao.getBandeira().equals("HIPC")) { |
||
| 536 | cartao.setBandeira("HIPERCARD"); |
||
| 537 | } |
||
| 538 | } |
||
| 539 | |||
| 540 | CartaoBandeiraDTO cartaoFormaDePagamento = new CartaoBandeiraDTO(); |
||
| 541 | cartaoFormaDePagamento.setBandeira(bandeiraCartaoService.consultarBandeiraCartoao(cartao.getBandeira(), tipoCartao)); |
||
| 542 | if (VerificadorUtil.estaNulo(cartaoFormaDePagamento.getBandeira())) { |
||
| 543 | cartaoFormaDePagamento.setBandeira(bandeiraCartaoService.consultarBandeiraCartoao("OUTROS", tipoCartao)); |
||
| 544 | } |
||
| 545 | cartaoFormaDePagamento.setBrutoImportado(cartao.getBrutoImportado()); |
||
| 546 | cartaoFormaDePagamento.setFormaPagamento(cartao.getFormaDePagamento()); |
||
| 547 | cartaoFormaDePagamento.setData(DataUtil.retornarDataFormatada("dd/MM/yyyy", data)); |
||
| 548 | cartaoResumo.adicionarPagamentoImportado(cartaoFormaDePagamento); |
||
| 549 | } |
||
| 550 | |||
| 551 | private void preencherDados(VendaFormaPagamento vendaFormaPagamento) { |
||
| 552 | CartaoBandeiraDTO cartaoFormaDePagamento = new CartaoBandeiraDTO(); |
||
| 553 | cartaoFormaDePagamento.setBandeira(vendaFormaPagamento.getBandeiraCartao()); |
||
| 554 | cartaoFormaDePagamento.setBruto(vendaFormaPagamento.getValorPagamento()); |
||
| 555 | cartaoFormaDePagamento.setFormaPagamento(vendaFormaPagamento.getFormaPagamento()); |
||
| 556 | cartaoFormaDePagamento.setData(DataUtil.retornarDataFormatada("dd/MM/yyyy", vendaFormaPagamento.getVenda().getDataVenda())); |
||
| 557 | cartaoResumo.adicionarPagamento(cartaoFormaDePagamento); |
||
| 558 | } |
||
| 559 | |||
| 675 | blopes | 560 | private Boolean verificarSeEhDebito(String formaPagmento) { |
| 561 | String pagamento = StringUtil.setarUpperCaseComTrim(formaPagmento); |
||
| 562 | if (VerificadorUtil.naoEstaNuloOuVazio(formaPagmento)) { |
||
| 563 | if (pagamento.contains("DÉBITO") || pagamento.contains("D�BITO") || pagamento.contains("DéBITO")) { |
||
| 564 | return true; |
||
| 565 | } |
||
| 566 | } |
||
| 567 | return false; |
||
| 568 | } |
||
| 569 | |||
| 570 | private Boolean verificarSeEhCreditoAvista(String parcelas) { |
||
| 571 | String pagamento = StringUtil.setarUpperCaseComTrim(parcelas); |
||
| 572 | if (VerificadorUtil.naoEstaNuloOuVazio(parcelas)) { |
||
| 573 | if (pagamento.contains("VISTA")) { |
||
| 574 | return true; |
||
| 575 | } |
||
| 576 | } |
||
| 577 | return false; |
||
| 578 | } |
||
| 579 | |||
| 106 | espaco | 580 | public void verificarLancamentos() { |
| 581 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 582 | public void execute() { |
||
| 583 | limparEntidade(); |
||
| 584 | List<VendaFormaPagamento> preLancamentos = new ArrayList<VendaFormaPagamento>(); |
||
| 585 | preLancamentos = vendaFormaPagamentoService.consultarLancamentosCartoesNoPeriodo(dataVendas, dataVendas, null, getMaquinetasSelecionadas()); |
||
| 586 | setListaVendaFormaPagamento(preLancamentos); |
||
| 587 | |||
| 588 | cartoes = new ArrayList<CartaoDTO>(); |
||
| 589 | cartaoResumo = new CartaoResumoDTO(); |
||
| 590 | for (VendaFormaPagamento vendaFormaPagamento : preLancamentos) { |
||
| 591 | if (VerificadorUtil.estaNulo(vendaFormaPagamento.getCupom())) { |
||
| 592 | CartaoDTO cartao = new CartaoDTO(); |
||
| 593 | cartao.setBandeira(vendaFormaPagamento.getBandeiraCartao().getDescricao()); |
||
| 594 | cartao.setFormaDePagamento(vendaFormaPagamento.getFormaPagamento()); |
||
| 595 | cartao.setBruto(vendaFormaPagamento.getValorPagamento()); |
||
| 596 | cartao.setDataVenda(vendaFormaPagamento.getVenda().getDataVenda()); |
||
| 597 | |||
| 598 | if (parcelaService.verificarPossuiParcelaAberta(vendaFormaPagamento.getVenda())) { |
||
| 599 | cartao.setParcelaGerada(true); |
||
| 600 | cartao.setGerarParcela(false); |
||
| 601 | } else { |
||
| 602 | cartao.setParcelaGerada(false); |
||
| 603 | cartao.setGerarParcela(true); |
||
| 604 | } |
||
| 605 | cartao.setVendaFormaPagamento(vendaFormaPagamento); |
||
| 606 | cartoes.add(cartao); |
||
| 607 | |||
| 608 | CartaoBandeiraDTO cartaoFormaDePagamento = new CartaoBandeiraDTO(); |
||
| 609 | cartaoFormaDePagamento.setBandeira(vendaFormaPagamento.getBandeiraCartao()); |
||
| 610 | cartaoFormaDePagamento.setBruto(vendaFormaPagamento.getValorPagamento()); |
||
| 611 | cartaoFormaDePagamento.setFormaPagamento(vendaFormaPagamento.getFormaPagamento()); |
||
| 612 | cartaoResumo.adicionarPagamento(cartaoFormaDePagamento); |
||
| 613 | } |
||
| 614 | } |
||
| 615 | cartoes = (List<CartaoDTO>) ordenador.ordenar(cartoes); |
||
| 616 | cartaoResumo.setCartoesPorBandeira((List<CartaoBandeiraDTO>) ordenador.ordenar(cartaoResumo.getCartoesPorBandeira())); |
||
| 617 | } |
||
| 618 | }); |
||
| 619 | } |
||
| 620 | |||
| 621 | public void consultarLancamentos() { |
||
| 622 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 623 | public void execute() { |
||
| 624 | limparEntidade(); |
||
| 625 | List<CartaoDTO> cartoesGerados = parcelaService.consultarContasDosCartoes(dataVendas, dataVendas); |
||
| 626 | adicionarDatasGeradas(cartoesGerados); |
||
| 627 | setCartoesGerados(cartoesGerados); |
||
| 628 | LancadorMensagem.lancarSucesso("PARCELAS GERADAS COM SUCESSO"); |
||
| 629 | } |
||
| 630 | }); |
||
| 631 | } |
||
| 632 | |||
| 633 | public void gerarLancamentos() { |
||
| 634 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 635 | public void execute() { |
||
| 636 | listaVendaFormaPagamento = new ArrayList<VendaFormaPagamento>(); |
||
| 637 | for (CartaoDTO cartao : cartoes) { |
||
| 638 | if (cartao.getGerarParcela()) { |
||
| 639 | listaVendaFormaPagamento.add(cartao.getVendaFormaPagamento()); |
||
| 640 | } |
||
| 641 | } |
||
| 642 | limparEntidade(); |
||
| 643 | List<CartaoDTO> cartoesGerados = parcelaService.gerarContasDosCartoes(listaVendaFormaPagamento); |
||
| 644 | adicionarDatasGeradas(cartoesGerados); |
||
| 645 | setCartoesGerados(cartoesGerados); |
||
| 646 | LancadorMensagem.lancarSucesso("PARCELAS GERADAS COM SUCESSO"); |
||
| 647 | } |
||
| 648 | |||
| 649 | }); |
||
| 650 | } |
||
| 651 | |||
| 652 | private void adicionarDatasGeradas(List<CartaoDTO> cartoesGerados) { |
||
| 653 | listaDatas = new ArrayList<CartaoDataDTO>(); |
||
| 654 | for (CartaoDTO cartaoGerado : cartoesGerados) { |
||
| 655 | CartaoDataDTO cartaoDataDTO = new CartaoDataDTO(); |
||
| 656 | cartaoDataDTO.setDataVenda(DateUtils.truncate(cartaoGerado.getParcela().getDataVencimento(), Calendar.DATE)); |
||
| 657 | cartaoDataDTO.setDataNovaVenda(DateUtils.truncate(cartaoGerado.getParcela().getDataVencimento(), Calendar.DATE)); |
||
| 658 | boolean adicionar = true; |
||
| 659 | for (CartaoDataDTO dataAdicionada : listaDatas) { |
||
| 660 | if (dataAdicionada.getDataVenda().equals(cartaoDataDTO.getDataVenda())) { |
||
| 661 | adicionar = false; |
||
| 662 | break; |
||
| 663 | } |
||
| 664 | } |
||
| 665 | if (adicionar) { |
||
| 666 | listaDatas.add(cartaoDataDTO); |
||
| 667 | } |
||
| 668 | } |
||
| 669 | } |
||
| 670 | |||
| 671 | public void atualizarDatasCartoes() { |
||
| 672 | for (CartaoDTO cartaoGerado : getCartoesGerados()) { |
||
| 673 | for (CartaoDataDTO dataAdicionada : getListaDatas()) { |
||
| 674 | Date dataTruncada = DateUtils.truncate(cartaoGerado.getParcela().getDataVencimento(), Calendar.DATE); |
||
| 675 | if (dataAdicionada.getDataVenda().equals(dataTruncada)) { |
||
| 676 | Date novaData = atualizarParaNovaData(cartaoGerado.getParcela().getDataVencimento(), dataAdicionada.getDataNovaVenda()); |
||
| 677 | cartaoGerado.getParcela().setDataVencimento(novaData); |
||
| 678 | } |
||
| 679 | } |
||
| 680 | } |
||
| 681 | adicionarDatasGeradas(getCartoesGerados()); |
||
| 682 | salvarAlteracoesCartoes(); |
||
| 683 | } |
||
| 684 | |||
| 685 | private Date atualizarParaNovaData(Date data, Date novaData) { |
||
| 686 | Calendar c = Calendar.getInstance(); |
||
| 687 | c.setTime(data); |
||
| 688 | |||
| 689 | Calendar cal = Calendar.getInstance(); |
||
| 690 | cal.setTime(novaData); |
||
| 691 | c.set(Calendar.DATE, cal.get(Calendar.DATE)); |
||
| 692 | c.set(Calendar.MONTH, cal.get(Calendar.MONTH)); |
||
| 693 | c.set(Calendar.YEAR, cal.get(Calendar.YEAR)); |
||
| 694 | return c.getTime(); |
||
| 695 | } |
||
| 696 | |||
| 697 | public void salvarAlteracoesCartoes() { |
||
| 698 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
||
| 699 | public void execute() { |
||
| 700 | for (CartaoDTO cartao : getCartoesGerados()) { |
||
| 701 | parcelaService.alterar(cartao.getParcela()); |
||
| 702 | } |
||
| 703 | LancadorMensagem.lancarSucesso("PARCELAS ATUALIZADAS COM SUCESSO"); |
||
| 704 | } |
||
| 705 | }); |
||
| 706 | } |
||
| 707 | |||
| 708 | /* |
||
| 709 | public static void main(String[] args) throws Exception { |
||
| 710 | BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream("C:\\arquivo.csv"))); |
||
| 711 | String linha = reader.readLine(); |
||
| 712 | |||
| 713 | List<CartaoDTO> cartoes = new ArrayList<CartaoDTO>(); |
||
| 714 | CartaoResumoDTO cartaoResumo = new CartaoResumoDTO(); |
||
| 715 | Double valorTotalBrutoCartoes = new Double(0.0); |
||
| 716 | while ((linha = reader.readLine()) != null) { |
||
| 717 | String[] dadosSeparados = linha.split(";"); |
||
| 718 | CartaoDTO cartao = new CartaoDTO(); |
||
| 719 | cartao.setBandeira(StringUtil.setarUpperCaseComTrim(dadosSeparados[5])); |
||
| 720 | FormaPagamento formaPagamento = null; |
||
| 721 | String bandeira = StringUtil.setarUpperCaseComTrim(dadosSeparados[4]); |
||
| 722 | String tipoCartao = null; |
||
| 723 | if (bandeira.equals("DÉBITO")) { |
||
| 724 | tipoCartao = TipoCartao.DEBITO.getValor(); |
||
| 725 | formaPagamento = new FormaPagamento(ConstantesSEC.FormasDePagamento.FORMAPAGAMENTO_DEBITO); |
||
| 726 | } else { |
||
| 727 | tipoCartao = TipoCartao.CREDITO.getValor(); |
||
| 728 | String parcelas = dadosSeparados[3]; |
||
| 729 | formaPagamento = new FormaPagamento(FormaPagamento.recuperarCodigoDaFormaDePagamento(parcelas)); |
||
| 730 | } |
||
| 731 | cartao.setFormaDePagamento(formaPagamento); |
||
| 732 | cartao.setBruto(new Double(dadosSeparados[2])); |
||
| 733 | cartao.setDataVenda(DataUtil.retornarDataApartirString("dd/MM/yyyy", dadosSeparados[0])); |
||
| 734 | |||
| 735 | cartoes.add(cartao); |
||
| 736 | // somarValoresBruto(vendaFormaPagamento.getValorPagamento(), vendaFormaPagamento.getFormaPagamento()); |
||
| 737 | // somarValoresBruto(cartao.getBruto(), cartao.getFormaDePagamento()); |
||
| 738 | |||
| 739 | CartaoBandeiraDTO cartaoFormaDePagamento = new CartaoBandeiraDTO(); |
||
| 740 | |||
| 741 | BandeiraCartao bandeiraCartao = bandeiraCartaoService.consultarBandeiraCartoao(cartao.getBandeira(), tipoCartao); |
||
| 742 | cartaoFormaDePagamento.setBandeira(bandeiraCartao); |
||
| 743 | cartaoFormaDePagamento.setBruto(cartao.getBruto()); |
||
| 744 | cartaoFormaDePagamento.setFormaPagamento(cartao.getFormaDePagamento()); |
||
| 745 | cartaoResumo.adicionarPagamento(cartaoFormaDePagamento); |
||
| 746 | } |
||
| 747 | reader.close(); |
||
| 748 | // System.out.println(Arrays.toString(dadosSeparados)); |
||
| 749 | // System.out.println("Nome: " + dadosSeparados[0]); |
||
| 750 | // System.out.println("País: " + dadosSeparados[1]); |
||
| 751 | // System.out.println("Fórum: " + dadosSeparados[2]); |
||
| 752 | // System.out.println("--------------------------"); |
||
| 753 | } |
||
| 754 | */ |
||
| 755 | /***************************************************************/ |
||
| 756 | |||
| 757 | } |