Rev 200 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 200 | Rev 204 | ||
|---|---|---|---|
| Line 13... | Line 13... | ||
| 13 | 13 | ||
| 14 | import org.primefaces.model.DefaultStreamedContent; |
14 | import org.primefaces.model.DefaultStreamedContent; |
| 15 | import org.primefaces.model.StreamedContent; |
15 | import org.primefaces.model.StreamedContent; |
| 16 | 16 | ||
| 17 | import br.com.ec.core.exception.NegocioException; |
17 | import br.com.ec.core.exception.NegocioException; |
| - | 18 | import br.com.ec.core.util.TipoExtensao; |
|
| 18 | import br.com.ec.core.util.VerificadorUtil; |
19 | import br.com.ec.core.util.VerificadorUtil; |
| 19 | import br.com.ec.domain.dto.FiltroComprovanteAvaria; |
20 | import br.com.ec.domain.dto.FiltroComprovanteAvaria; |
| 20 | import br.com.ec.domain.dto.FiltroComprovanteCupom; |
21 | import br.com.ec.domain.dto.FiltroComprovanteCupom; |
| 21 | import br.com.ec.domain.dto.FiltroComprovanteRegistroPonto; |
22 | import br.com.ec.domain.dto.FiltroComprovanteRegistroPonto; |
| 22 | import br.com.ec.domain.dto.FiltroComprovanteReserva; |
23 | import br.com.ec.domain.dto.FiltroComprovanteReserva; |
| Line 266... | Line 267... | ||
| 266 | setTransferencia(transferencia); |
267 | setTransferencia(transferencia); |
| 267 | }
|
268 | }
|
| 268 | 269 | ||
| 269 | public StreamedContent gerarComprovante(JasperPrint relatorio) { |
270 | public StreamedContent gerarComprovante(JasperPrint relatorio) { |
| 270 | setEmitirComprovante(false); |
271 | setEmitirComprovante(false); |
| 271 | return (StreamedContent) new DefaultStreamedContent(new ByteArrayInputStream(retornarByterRelatorio(relatorio)), "image/png", "comprovante.png"); |
- | |
| - | 272 | return (StreamedContent) DefaultStreamedContent.builder() |
|
| - | 273 | .contentType(TipoExtensao.PNG.getDescricao()) |
|
| - | 274 | .name("comprovante.png") |
|
| - | 275 | .stream(() -> new ByteArrayInputStream(retornarByterRelatorio(relatorio))).build(); |
|
| 272 | }
|
276 | }
|
| 273 | 277 | ||
| 274 | private byte[] retornarByterRelatorio(final JasperPrint relatorio) { |
278 | private byte[] retornarByterRelatorio(final JasperPrint relatorio) { |
| 275 | byte[] imageBytes = null; |
279 | byte[] imageBytes = null; |
| 276 | try { |
280 | try { |