Rev 462 | Rev 468 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 462 | Rev 467 | ||
|---|---|---|---|
| Line 2... | Line 2... | ||
| 2 | 2 | ||
| 3 | import java.io.Serializable; |
3 | import java.io.Serializable; |
| - | 4 | ||
| - | 5 | import br.com.ec.core.util.VerificadorUtil; |
|
| - | 6 | import br.com.ec.domain.model.NotaFiscal; |
|
| - | 7 | import br.com.ec.web.util.DataUtil; |
|
| 4 | 8 | ||
| 5 | public class NotaFiscalDTO implements Serializable { |
9 | public class NotaFiscalDTO implements Serializable { |
| 6 | 10 | ||
| 7 | private static final long serialVersionUID = 1L; |
11 | private static final long serialVersionUID = 1L; |
| 8 | 12 | ||
| Line 25... | Line 29... | ||
| 25 | private String caminhoQrCode = "";
|
29 | private String caminhoQrCode = "";
|
| 26 | */
|
30 | */
|
| 27 | 31 | ||
| 28 | public NotaFiscalDTO() { |
32 | public NotaFiscalDTO() { |
| 29 | setChave(""); |
33 | setChave(""); |
| - | 34 | }
|
|
| - | 35 | ||
| - | 36 | public NotaFiscalDTO(NotaFiscal notaFiscal) { |
|
| - | 37 | /*
|
|
| - | 38 | this.setVenda(notaFiscal.getVenda());
|
|
| - | 39 | this.setNumero("" + notaFiscal.getNumeroNotaFiscal());
|
|
| - | 40 | this.setSerie(notaFiscal.getSerie());
|
|
| - | 41 | this.setChave(notaFiscal.getChave());
|
|
| - | 42 | this.setCaminhoQrCode(notaFiscal.getCaminhoQrcode());
|
|
| - | 43 | // this.setCpfCnpjConsumidor("NÃO INFORMADO");
|
|
| - | 44 | if (VerificadorUtil.naoEstaNulo(notaFiscal.getVenda())) {
|
|
| - | 45 | if (VerificadorUtil.naoEstaNulo(notaFiscal.getVenda().getCliente())) {
|
|
| - | 46 | this.setCpfCnpjConsumidor(notaFiscal.getVenda().getCliente().getCpfCnpj());
|
|
| - | 47 | }
|
|
| - | 48 | }
|
|
| - | 49 | this.setDataHoraEmissao(DataUtil.retornarDataFormatadaEmFormatoTexto("yyyy-MM-dd HH:mm:ss", notaFiscal.getDataHoraEmissao()));
|
|
| - | 50 | this.setProtocoloAutorizacao(notaFiscal.getProtocoloAutorizacao());
|
|
| - | 51 | */
|
|
| 30 | }
|
52 | }
|
| 31 | 53 | ||
| 32 | public static String CONSULTA_DTO_SIMPLES = "e.sequencial, e.chave"; |
54 | public static String CONSULTA_DTO_SIMPLES = "e.sequencial, e.chave"; |
| 33 | public NotaFiscalDTO(Long sequencial, String chave) { |
55 | public NotaFiscalDTO(Long sequencial, String chave) { |
| 34 | this.sequencialNotaFiscal = sequencial; |
56 | this.sequencialNotaFiscal = sequencial; |
| Line 55... | Line 77... | ||
| 55 | if (VerificadorUtil.naoEstaNulo(venda.getCliente())) {
|
77 | if (VerificadorUtil.naoEstaNulo(venda.getCliente())) {
|
| 56 | this.setCpfCnpjConsumidor(venda.getCliente().getCpfCnpj());
|
78 | this.setCpfCnpjConsumidor(venda.getCliente().getCpfCnpj());
|
| 57 | } else {
|
79 | } else {
|
| 58 | this.setCpfCnpjConsumidor("NÃO INFORMADO");
|
80 | this.setCpfCnpjConsumidor("NÃO INFORMADO");
|
| 59 | }
|
81 | }
|
| 60 | }
|
- | |
| 61 |
|
- | |
| 62 | public NotaFiscalDTO(NotaFiscal notaFiscal) {
|
- | |
| 63 | this.setVenda(notaFiscal.getVenda());
|
- | |
| 64 | this.setNumero("" + notaFiscal.getNumeroNotaFiscal());
|
- | |
| 65 | this.setSerie(notaFiscal.getSerie());
|
- | |
| 66 | this.setChave(notaFiscal.getChave());
|
- | |
| 67 | this.setCaminhoQrCode(notaFiscal.getCaminhoQrcode());
|
- | |
| 68 | this.setCpfCnpjConsumidor("NÃO INFORMADO");
|
- | |
| 69 | if (VerificadorUtil.naoEstaNulo(notaFiscal.getVenda())) {
|
- | |
| 70 | if (VerificadorUtil.naoEstaNulo(notaFiscal.getVenda().getCliente())) {
|
- | |
| 71 | this.setCpfCnpjConsumidor(notaFiscal.getVenda().getCliente().getCpfCnpj());
|
- | |
| 72 | }
|
- | |
| 73 | }
|
- | |
| 74 | this.setDataHoraEmissao(DataUtil.retornarDataFormatadaEmFormatoTexto("yyyy-MM-dd HH:mm:ss", notaFiscal.getDataHoraEmissao()));
|
- | |
| 75 | this.setProtocoloAutorizacao(notaFiscal.getProtocoloAutorizacao());
|
- | |
| 76 | }
|
82 | }
|
| 77 |
|
83 |
|
| 78 | public NotaFiscalDTO(TNfeProc nfeProc, Venda vendaCompleta) {
|
84 | public NotaFiscalDTO(TNfeProc nfeProc, Venda vendaCompleta) {
|
| 79 | Pessoa pessoaJuridica = new Pessoa();
|
85 | Pessoa pessoaJuridica = new Pessoa();
|
| 80 | pessoaJuridica.setCpfCnpj(nfeProc.getNFe().getInfNFe().getEmit().getCNPJ());
|
86 | pessoaJuridica.setCpfCnpj(nfeProc.getNFe().getInfNFe().getEmit().getCNPJ());
|