Rev 571 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 571 | Rev 572 | ||
|---|---|---|---|
| Line 10... | Line 10... | ||
| 10 | import org.springframework.context.annotation.Scope; |
10 | import org.springframework.context.annotation.Scope; |
| 11 | 11 | ||
| 12 | import br.com.ec.controller.util.IpUtil; |
12 | import br.com.ec.controller.util.IpUtil; |
| 13 | import br.com.ec.core.generic.GenericService; |
13 | import br.com.ec.core.generic.GenericService; |
| 14 | import br.com.ec.core.util.DataUtils; |
14 | import br.com.ec.core.util.DataUtils; |
| - | 15 | import br.com.ec.core.util.VerificadorUtil; |
|
| 15 | import br.com.ec.domain.model.Ponto; |
16 | import br.com.ec.domain.model.Ponto; |
| - | 17 | import br.com.ec.domain.model.TransferenciaProduto; |
|
| - | 18 | import br.com.ec.domain.service.email.impl.GerenciadorEmailImpl; |
|
| 16 | import br.com.ec.domain.service.ponto.PontoService; |
19 | import br.com.ec.domain.service.ponto.PontoService; |
| - | 20 | import br.com.ec.domain.shared.ConstantesSEC; |
|
| 17 | import br.com.ec.web.exception.VerificadorLancamentoException; |
21 | import br.com.ec.web.exception.VerificadorLancamentoException; |
| 18 | import br.com.ec.web.exception.VerificadorLancamentoException.CommandBean; |
22 | import br.com.ec.web.exception.VerificadorLancamentoException.CommandBean; |
| 19 | import br.com.ec.web.generic.AbstractBean; |
23 | import br.com.ec.web.generic.AbstractBean; |
| 20 | import br.com.ec.web.message.LancadorMensagem; |
24 | import br.com.ec.web.message.LancadorMensagem; |
| 21 | 25 | ||
| Line 83... | Line 87... | ||
| 83 | public void baterPontoInicio() { |
87 | public void baterPontoInicio() { |
| 84 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
88 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
| 85 | public void execute() { |
89 | public void execute() { |
| 86 | getEntidade().setDataHoraPontoInicio(DataUtils.getDataAtual()); |
90 | getEntidade().setDataHoraPontoInicio(DataUtils.getDataAtual()); |
| 87 | getEntidade().setIpPontoInicio(recuperarIpUsuario()); |
91 | getEntidade().setIpPontoInicio(recuperarIpUsuario()); |
| - | 92 | verificarSeIpIgualLoja(recuperarIpUsuario()); |
|
| 88 | baterPonto(); |
93 | baterPonto(); |
| 89 | }
|
94 | }
|
| 90 | }); |
95 | }); |
| 91 | }
|
96 | }
|
| 92 | 97 | ||
| Line 102... | Line 107... | ||
| 102 | public void baterPontoFim() { |
107 | public void baterPontoFim() { |
| 103 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
108 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
| 104 | public void execute() { |
109 | public void execute() { |
| 105 | getEntidade().setDataHoraPontoFim(DataUtils.getDataAtual()); |
110 | getEntidade().setDataHoraPontoFim(DataUtils.getDataAtual()); |
| 106 | getEntidade().setIpPontoFim(recuperarIpUsuario()); |
111 | getEntidade().setIpPontoFim(recuperarIpUsuario()); |
| - | 112 | verificarSeIpIgualLoja(recuperarIpUsuario()); |
|
| 107 | baterPonto(); |
113 | baterPonto(); |
| 108 | }
|
114 | }
|
| 109 | }); |
115 | }); |
| 110 | }
|
116 | }
|
| 111 | 117 | ||
| Line 121... | Line 127... | ||
| 121 | public void baterIntervaloInicio() { |
127 | public void baterIntervaloInicio() { |
| 122 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
128 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
| 123 | public void execute() { |
129 | public void execute() { |
| 124 | getEntidade().setDataHoraIntervaloInicio(DataUtils.getDataAtual()); |
130 | getEntidade().setDataHoraIntervaloInicio(DataUtils.getDataAtual()); |
| 125 | getEntidade().setIpPontoIntervaloInicio(recuperarIpUsuario()); |
131 | getEntidade().setIpPontoIntervaloInicio(recuperarIpUsuario()); |
| - | 132 | verificarSeIpIgualLoja(recuperarIpUsuario()); |
|
| 126 | baterPonto(); |
133 | baterPonto(); |
| 127 | }
|
134 | }
|
| 128 | }); |
135 | }); |
| 129 | }
|
136 | }
|
| 130 | 137 | ||
| Line 140... | Line 147... | ||
| 140 | public void baterIntervaloFim() { |
147 | public void baterIntervaloFim() { |
| 141 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
148 | new VerificadorLancamentoException().tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean() { |
| 142 | public void execute() { |
149 | public void execute() { |
| 143 | getEntidade().setDataHoraIntervaloFim(DataUtils.getDataAtual()); |
150 | getEntidade().setDataHoraIntervaloFim(DataUtils.getDataAtual()); |
| 144 | getEntidade().setIpPontoIntervaloFim(recuperarIpUsuario()); |
151 | getEntidade().setIpPontoIntervaloFim(recuperarIpUsuario()); |
| - | 152 | verificarSeIpIgualLoja(recuperarIpUsuario()); |
|
| 145 | baterPonto(); |
153 | baterPonto(); |
| 146 | }
|
154 | }
|
| 147 | }); |
155 | }); |
| 148 | }
|
156 | }
|
| 149 | 157 | ||
| Line 162... | Line 170... | ||
| 162 | }
|
170 | }
|
| 163 | 171 | ||
| 164 | private void baterPonto() { |
172 | private void baterPonto() { |
| 165 | pontoService.alterar(getEntidade()); |
173 | pontoService.alterar(getEntidade()); |
| 166 | limparEntidade(); |
174 | limparEntidade(); |
| 167 | LancadorMensagem.lancarSucesso("PONTO ALTERADO COM SUCESSO!"); |
- | |
| - | 175 | LancadorMensagem.lancarSucesso("PONTO REALIZADO COM SUCESSO!"); |
|
| - | 176 | }
|
|
| - | 177 | ||
| - | 178 | private void verificarSeIpIgualLoja(String ipUsuario) { |
|
| - | 179 | if (VerificadorUtil.naoEstaNuloOuVazio(getEntidade().getLoja().getIpInternet())) { |
|
| - | 180 | if (!ipUsuario.contains(getEntidade().getLoja().getIpInternet())) { |
|
| - | 181 | StringBuilder conteudo = new StringBuilder(); |
|
| - | 182 | conteudo.append(getEntidade().getNomeDaPessoa() + "\n"); |
|
| - | 183 | conteudo.append("LOJA: " + getEntidade().getLoja().getDescricao() + "\n"); |
|
| - | 184 | conteudo.append("DATA: " + DataUtils.converterDataComHorarioParaString(DataUtils.getDataAtual()) + "\n"); |
|
| - | 185 | conteudo.append("\n\n"); |
|
| - | 186 | conteudo.toString(); |
|
| - | 187 | ||
| - | 188 | new GerenciadorEmailImpl() |
|
| - | 189 | .comEmailsDestino(ConstantesSEC.DESTINATARIOS_EMAIL_GESTAO) |
|
| - | 190 | .comAssunto("ESPAĆO CASE - PONTO SUSPEITO DE " + getEntidade().getNomeDaPessoa()) |
|
| - | 191 | .comConteudo(conteudo.toString()) |
|
| - | 192 | .enviar(); |
|
| - | 193 | }
|
|
| - | 194 | }
|
|
| 168 | }
|
195 | }
|
| 169 | 196 | ||
| 170 | }
|
197 | }
|