Rev 627 | Rev 629 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 627 | Rev 628 | ||
|---|---|---|---|
| Line 5... | Line 5... | ||
| 5 | import java.util.List; |
5 | import java.util.List; |
| 6 | 6 | ||
| 7 | import javax.inject.Inject; |
7 | import javax.inject.Inject; |
| 8 | import javax.inject.Named; |
8 | import javax.inject.Named; |
| 9 | 9 | ||
| - | 10 | import org.apache.commons.httpclient.util.DateUtil; |
|
| - | 11 | import org.apache.commons.lang.time.DateUtils; |
|
| 10 | import org.springframework.context.annotation.Scope; |
12 | import org.springframework.context.annotation.Scope; |
| 11 | 13 | ||
| 12 | import br.com.ec.core.generic.GenericService; |
14 | import br.com.ec.core.generic.GenericService; |
| - | 15 | import br.com.ec.core.util.DataUtils; |
|
| 13 | import br.com.ec.core.util.VerificadorUtil; |
16 | import br.com.ec.core.util.VerificadorUtil; |
| 14 | import br.com.ec.domain.dto.ComercialPosVendaDTO; |
17 | import br.com.ec.domain.dto.ComercialPosVendaDTO; |
| 15 | import br.com.ec.domain.dto.PosVendaDTO; |
- | |
| 16 | import br.com.ec.domain.model.Loja; |
- | |
| 17 | import br.com.ec.domain.model.NpsPosVenda; |
18 | import br.com.ec.domain.model.NpsPosVenda; |
| 18 | import br.com.ec.domain.model.PosVenda; |
19 | import br.com.ec.domain.model.PosVenda; |
| 19 | import br.com.ec.domain.model.tipos.TipoNpsPosVenda; |
20 | import br.com.ec.domain.model.tipos.TipoNpsPosVenda; |
| 20 | import br.com.ec.domain.model.tipos.TipoPeriodoConsulta; |
21 | import br.com.ec.domain.model.tipos.TipoPeriodoConsulta; |
| 21 | import br.com.ec.domain.service.LancamentoService; |
- | |
| 22 | import br.com.ec.domain.service.PosVendaService; |
- | |
| - | 22 | import br.com.ec.domain.service.NpsPosVendaService; |
|
| 23 | import br.com.ec.web.exception.VerificadorLancamentoException; |
23 | import br.com.ec.web.exception.VerificadorLancamentoException; |
| 24 | import br.com.ec.web.exception.VerificadorLancamentoException.CommandBean; |
24 | import br.com.ec.web.exception.VerificadorLancamentoException.CommandBean; |
| 25 | import br.com.ec.web.generic.AbstractBean; |
25 | import br.com.ec.web.generic.AbstractBean; |
| 26 | 26 | ||
| 27 | @Named |
27 | @Named |
| 28 | @Scope("view") |
28 | @Scope("view") |
| 29 | public class NpsPosVendaBean extends AbstractBean<ComercialPosVendaDTO> implements Serializable { |
29 | public class NpsPosVendaBean extends AbstractBean<ComercialPosVendaDTO> implements Serializable { |
| 30 | 30 | ||
| 31 | private static final long serialVersionUID = 1L; |
31 | private static final long serialVersionUID = 1L; |
| 32 | 32 | ||
| 33 | private PosVendaService posVendaService; |
- | |
| - | 33 | private NpsPosVendaService npsPosVendaService; |
|
| 34 | 34 | ||
| 35 | private NpsPosVenda npsPosVendaSelecionado; |
35 | private NpsPosVenda npsPosVendaSelecionado; |
| 36 | 36 | ||
| 37 | public static class NpsItem { |
37 | public static class NpsItem { |
| 38 | private final Integer nota; |
38 | private final Integer nota; |
| Line 49... | Line 49... | ||
| 49 | public String getIcone() { return icone; } |
49 | public String getIcone() { return icone; } |
| 50 | public String getEstrelas() { return estrelas; } |
50 | public String getEstrelas() { return estrelas; } |
| 51 | }
|
51 | }
|
| 52 | 52 | ||
| 53 | @Inject |
53 | @Inject |
| 54 | public NpsPosVendaBean(PosVendaService posVendaService) { |
- | |
| 55 | this.posVendaService = posVendaService; |
- | |
| - | 54 | public NpsPosVendaBean(NpsPosVendaService npsPosVendaService) { |
|
| - | 55 | this.npsPosVendaService = npsPosVendaService; |
|
| 56 | }
|
56 | }
|
| 57 | 57 | ||
| 58 | @Override |
58 | @Override |
| 59 | public GenericService<ComercialPosVendaDTO> getService() { |
59 | public GenericService<ComercialPosVendaDTO> getService() { |
| 60 | return null; |
60 | return null; |
| Line 81... | Line 81... | ||
| 81 | String estrelas = new String(new char[5]).replace("\0", "⭐");//"⭐".repeat(Math.max(0, i / 2)); // Converte nota para estrelas visuais |
81 | String estrelas = new String(new char[5]).replace("\0", "⭐");//"⭐".repeat(Math.max(0, i / 2)); // Converte nota para estrelas visuais |
| 82 | lista.add(new NpsItem(new Integer(i), icone, estrelas)); |
82 | lista.add(new NpsItem(new Integer(i), icone, estrelas)); |
| 83 | }
|
83 | }
|
| 84 | return lista; |
84 | return lista; |
| 85 | }
|
85 | }
|
| 86 | - | ||
| 87 | - | ||
| 88 | 86 | ||
| 89 | /**************************************************/
|
87 | /**************************************************/
|
| 90 | 88 | ||
| 91 | public TipoPeriodoConsulta[] getTiposPeriodoConsulta() { |
89 | public TipoPeriodoConsulta[] getTiposPeriodoConsulta() { |
| 92 | return TipoPeriodoConsulta.values(); |
90 | return TipoPeriodoConsulta.values(); |
| Line 105... | Line 103... | ||
| 105 | }
|
103 | }
|
| 106 | return npsPosVendaSelecionado; |
104 | return npsPosVendaSelecionado; |
| 107 | }
|
105 | }
|
| 108 | public void setNpsPosVendaSelecionado(NpsPosVenda npsPosVendaSelecionado) { |
106 | public void setNpsPosVendaSelecionado(NpsPosVenda npsPosVendaSelecionado) { |
| 109 | this.npsPosVendaSelecionado = npsPosVendaSelecionado; |
107 | this.npsPosVendaSelecionado = npsPosVendaSelecionado; |
| - | 108 | }
|
|
| - | 109 | ||
| - | 110 | public void selecionarNota() { |
|
| - | 111 | if (VerificadorUtil.naoEstaNulo(getNpsPosVendaSelecionado())) { |
|
| - | 112 | System.out.println(getNpsPosVendaSelecionado().getNota()); |
|
| - | 113 | } else { |
|
| - | 114 | System.out.println("SEM NOTA!"); |
|
| - | 115 | }
|
|
| 110 | }
|
116 | }
|
| 111 | 117 | ||
| 112 | public void efetivarNps() { |
118 | public void efetivarNps() { |
| 113 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
119 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
| 114 | public void execute() { |
120 | public void execute() { |
| 115 | - | ||
| - | 121 | getNpsPosVendaSelecionado().setDataFinalizacao(DataUtils.getDataAtual()); |
|
| - | 122 | npsPosVendaService.alterar(getNpsPosVendaSelecionado()); |
|
| 116 | }
|
123 | }
|
| 117 | }); |
124 | }); |
| 118 | }
|
125 | }
|
| 119 | 126 | ||
| 120 | }
|
127 | }
|