Rev 195 | Rev 328 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 195 | Rev 289 | ||
|---|---|---|---|
| Line 2... | Line 2... | ||
| 2 | 2 | ||
| 3 | import java.io.ByteArrayInputStream; |
3 | import java.io.ByteArrayInputStream; |
| - | 4 | import java.io.IOException; |
|
| - | 5 | import java.io.InputStream; |
|
| 4 | import java.io.Serializable; |
6 | import java.io.Serializable; |
| 5 | import java.util.ArrayList; |
7 | import java.util.ArrayList; |
| 6 | import java.util.HashSet; |
8 | import java.util.HashSet; |
| 7 | import java.util.List; |
9 | import java.util.List; |
| 8 | 10 | ||
| Line 14... | Line 16... | ||
| 14 | import org.primefaces.model.DefaultStreamedContent; |
16 | import org.primefaces.model.DefaultStreamedContent; |
| 15 | import org.primefaces.model.StreamedContent; |
17 | import org.primefaces.model.StreamedContent; |
| 16 | import org.springframework.context.annotation.Scope; |
18 | import org.springframework.context.annotation.Scope; |
| 17 | 19 | ||
| 18 | import br.com.ec.core.consulta.ParametrosConsulta; |
20 | import br.com.ec.core.consulta.ParametrosConsulta; |
| - | 21 | import br.com.ec.core.exception.NegocioException; |
|
| 19 | import br.com.ec.core.generic.GenericService; |
22 | import br.com.ec.core.generic.GenericService; |
| 20 | import br.com.ec.core.util.ArquivoUtil; |
23 | import br.com.ec.core.util.ArquivoUtil; |
| 21 | import br.com.ec.core.util.StringUtil; |
24 | import br.com.ec.core.util.StringUtil; |
| - | 25 | import br.com.ec.core.util.TipoExtensao; |
|
| 22 | import br.com.ec.core.util.VerificadorUtil; |
26 | import br.com.ec.core.util.VerificadorUtil; |
| 23 | import br.com.ec.domain.dto.ParametrosConsultaVendasDTO; |
27 | import br.com.ec.domain.dto.ParametrosConsultaVendasDTO; |
| 24 | import br.com.ec.domain.dto.ParametrosConsultaVendasVivoDTO; |
28 | import br.com.ec.domain.dto.ParametrosConsultaVendasVivoDTO; |
| 25 | import br.com.ec.domain.dto.RankingVendedorDTO; |
29 | import br.com.ec.domain.dto.RankingVendedorDTO; |
| 26 | import br.com.ec.domain.model.Avaliacao; |
30 | import br.com.ec.domain.model.Avaliacao; |
| Line 40... | Line 44... | ||
| 40 | import br.com.ec.domain.service.itemavaliacao.ItemAvaliacaoService; |
44 | import br.com.ec.domain.service.itemavaliacao.ItemAvaliacaoService; |
| 41 | import br.com.ec.domain.service.venda.VendaService; |
45 | import br.com.ec.domain.service.venda.VendaService; |
| 42 | import br.com.ec.domain.service.vendavivo.VendaVivoService; |
46 | import br.com.ec.domain.service.vendavivo.VendaVivoService; |
| 43 | import br.com.ec.domain.service.vendedor.VendedorService; |
47 | import br.com.ec.domain.service.vendedor.VendedorService; |
| 44 | import br.com.ec.domain.shared.ConstantesSEC; |
48 | import br.com.ec.domain.shared.ConstantesSEC; |
| - | 49 | import br.com.ec.relatorio.util.RelatorioUtils; |
|
| 45 | import br.com.ec.web.exception.VerificadorLancamentoException; |
50 | import br.com.ec.web.exception.VerificadorLancamentoException; |
| 46 | import br.com.ec.web.exception.VerificadorLancamentoException.CommandBean; |
51 | import br.com.ec.web.exception.VerificadorLancamentoException.CommandBean; |
| - | 52 | import br.com.ec.web.exception.VerificadorLancamentoException.CommandRelatorioStreamedContent; |
|
| 47 | import br.com.ec.web.generic.AbstractBean; |
53 | import br.com.ec.web.generic.AbstractBean; |
| 48 | import br.com.ec.web.message.LancadorMensagem; |
54 | import br.com.ec.web.message.LancadorMensagem; |
| 49 | import br.com.ec.web.util.TipoOperacao; |
55 | import br.com.ec.web.util.TipoOperacao; |
| 50 | 56 | ||
| 51 | @Named |
57 | @Named |
| Line 467... | Line 473... | ||
| 467 | LancadorMensagem.lancarSucesso("REAVALIAÇÃO SOLICITADA COM SUCESSO"); |
473 | LancadorMensagem.lancarSucesso("REAVALIAÇÃO SOLICITADA COM SUCESSO"); |
| 468 | }
|
474 | }
|
| 469 | }); |
475 | }); |
| 470 | }
|
476 | }
|
| 471 | 477 | ||
| 472 | public StreamedContent emitirRelatorioImportacaoFolhaPagamento(String codigoEmpresa) throws Exception { |
- | |
| 473 | String nomeArquivo = ""; |
- | |
| 474 | if (ConstantesSEC.Empresa.CODIGO_EMPRESA_ESPACO_CASE_1.equals(new Long(codigoEmpresa))) { |
- | |
| 475 | nomeArquivo = "Relatório de Importação - Folha de Pagamento Espaço Case.xls"; |
- | |
| 476 | } else if (ConstantesSEC.Empresa.CODIGO_EMPRESA_CASA_DAS_CAPAS_4.equals(new Long(codigoEmpresa))) { |
- | |
| 477 | nomeArquivo = "Relatório de Importação - Folha de Pagamento Casa das Capas.xls"; |
- | |
| 478 | }
|
- | |
| 479 | ByteArrayInputStream input = new ByteArrayInputStream(avaliacaoService.emitirRelatorioImportacaoFolhaPagamento((ServletContext)FacesContext.getCurrentInstance().getExternalContext().getContext(), getEntidade())); |
- | |
| 480 | return new DefaultStreamedContent(input, ArquivoUtil.retornarContentTypeArquivo("xls"), nomeArquivo); |
- | |
| - | 478 | public StreamedContent emitirRelatorioImportacaoFolhaPagamento(final String codigoEmpresa) { |
|
| - | 479 | return new VerificadorLancamentoException().verificarLancamentoException(new CommandRelatorioStreamedContent() { |
|
| - | 480 | @Override |
|
| - | 481 | public StreamedContent execute() { |
|
| - | 482 | String nomeArquivo = ""; |
|
| - | 483 | if (ConstantesSEC.Empresa.CODIGO_EMPRESA_ESPACO_CASE_1.equals(new Long(codigoEmpresa))) { |
|
| - | 484 | nomeArquivo = "Relatório de Importação - Folha de Pagamento Espaço Case.xls"; |
|
| - | 485 | } else if (ConstantesSEC.Empresa.CODIGO_EMPRESA_CASA_DAS_CAPAS_4.equals(new Long(codigoEmpresa))) { |
|
| - | 486 | nomeArquivo = "Relatório de Importação - Folha de Pagamento Casa das Capas.xls"; |
|
| - | 487 | }
|
|
| - | 488 | try { |
|
| - | 489 | ByteArrayInputStream input = new ByteArrayInputStream(avaliacaoService.emitirRelatorioImportacaoFolhaPagamento((ServletContext)FacesContext.getCurrentInstance().getExternalContext().getContext(), getEntidade())); |
|
| - | 490 | return new DefaultStreamedContent(input, ArquivoUtil.retornarContentTypeArquivo("xls"), nomeArquivo); |
|
| - | 491 | } catch (IOException e) { |
|
| - | 492 | e.printStackTrace(); |
|
| - | 493 | } catch (NegocioException nex) { |
|
| - | 494 | LancadorMensagem.lancarErro(nex.getMessage()); |
|
| - | 495 | }
|
|
| - | 496 | return null; |
|
| - | 497 | }
|
|
| - | 498 | }); |
|
| 481 | }
|
499 | }
|
| 482 | 500 | ||
| 483 | }
|
501 | }
|