Commit af0805c7bf91346e272404a93ed80afa1e84f6cc
1 parent
cd0e0599
Exists in
master
Ajustes no parametro de calculo
git-svn-id: https://svn.bento.ifrs.edu.br/default/ASES/e-selo@9840 c2178572-b5ca-4887-91d2-9e3a90c7d55b
Showing
6 changed files
with
44 additions
and
43 deletions
Show diff stats
Desenvolvimento/Codificacao/e-Selo/WebContent/WEB-INF/jsp/criterios/form.jsp
| ... | ... | @@ -103,7 +103,7 @@ |
| 103 | 103 | <td> |
| 104 | 104 | <div class="btn-group"> |
| 105 | 105 | <c:if test="${parametroCalculo.tsFim == null}"> |
| 106 | - <c:if test="${criterio.tipoTeste.id == 4}"> | |
| 106 | + <c:if test="${criterio.tipoTeste.id == 3}"> | |
| 107 | 107 | <a href="<c:url value="/faixas/form/${faixa.id}" />" class="btn btn-default btn-sm">Consultar</a> |
| 108 | 108 | </c:if> |
| 109 | 109 | <a href="<c:url value="/faixas/delete/${faixa.id}" />" class="btn btn-default btn-sm btn-confirm" data-msg="Deseja realmente excluir a faixa selecionado?">Excluir</a> | ... | ... |
Desenvolvimento/Codificacao/e-Selo/WebContent/WEB-INF/jsp/faixa/form.jsp
| ... | ... | @@ -5,7 +5,7 @@ |
| 5 | 5 | |
| 6 | 6 | <tiles:insertTemplate template="/WEB-INF/jsp/template/template.jsp"> |
| 7 | 7 | <tiles:putAttribute name="body"> |
| 8 | - <a href="<c:url value="/parametrosCalculo/atualizar/${parametroAvaliacao.id}"/>"><strong><span class="glyphicon glyphicon-check"></span> Parametros de Cálculo</strong></a> | |
| 8 | + <a href="<c:url value="/parametrosCalculo/atualizar/${parametroCalculo.id}"/>"><strong><span class="glyphicon glyphicon-check"></span> Parametros de Cálculo</strong></a> | |
| 9 | 9 | |
| 10 | 10 | <hr /> |
| 11 | 11 | |
| ... | ... | @@ -73,7 +73,7 @@ |
| 73 | 73 | <div class="form-group"> |
| 74 | 74 | <div class="col-lg-10 col-lg-offset-2"> |
| 75 | 75 | <button class="btn btn-default btn-cancel">Cancelar</button> |
| 76 | - <c:if test="${parametroAvaliacao.tsFim == null}"> | |
| 76 | + <c:if test="${parametroCalculo.tsFim == null}"> | |
| 77 | 77 | <button type="submit" class="btn btn-primary">Salvar</button> |
| 78 | 78 | </c:if> |
| 79 | 79 | </div> | ... | ... |
Desenvolvimento/Codificacao/e-Selo/src/main/java/br/com/eselo/controller/CriteriosController.java
| ... | ... | @@ -109,11 +109,7 @@ public class CriteriosController { |
| 109 | 109 | List<TipoTeste> tipoTestes = (List<TipoTeste>) dao.getAllTipoTeste(); |
| 110 | 110 | Criterio criterioCadastrado = dao.load(criterio.getId()); |
| 111 | 111 | |
| 112 | - criterioCadastrado.setNumeroCriterio(criterio.getNumeroCriterio()); | |
| 113 | - criterioCadastrado.setDescricao(criterio.getDescricao()); | |
| 114 | - criterioCadastrado.setPeso(criterio.getPeso()); | |
| 115 | - criterioCadastrado.setTipoTeste(criterio.getTipoTeste()); | |
| 116 | - | |
| 112 | + | |
| 117 | 113 | result.include("recomendacaoId", criterio.getRecomendacao().getId()); |
| 118 | 114 | result.include("parametroCalculo", criterio.getRecomendacao() |
| 119 | 115 | .getParametroCalculo()); |
| ... | ... | @@ -126,9 +122,12 @@ public class CriteriosController { |
| 126 | 122 | criterioCadastrado.getId()); |
| 127 | 123 | |
| 128 | 124 | if(validarAtualizacaoCriterio(criterio)){ |
| 125 | + | |
| 129 | 126 | criarNovoParametroAvaliacao(criterio,ParametroCalculoController.MODO_EDIT); |
| 130 | 127 | result.include("mensagem", "Critério salvo com sucesso."); |
| 131 | 128 | }else{ |
| 129 | + criterioCadastrado.setDescricao(criterio.getDescricao()); | |
| 130 | + dao.update(criterioCadastrado); | |
| 132 | 131 | result.include("mensagem", "Nenhum campo foi alterado."); |
| 133 | 132 | } |
| 134 | 133 | |
| ... | ... | @@ -253,7 +252,7 @@ public class CriteriosController { |
| 253 | 252 | alteracao = true; |
| 254 | 253 | } else if (criterio.getPeso().compareTo(criterioCadastrado.getPeso()) !=0) { |
| 255 | 254 | alteracao = true; |
| 256 | - } else if (criterio.getDescricao().compareTo(criterio.getDescricao()) != 0) { | |
| 255 | + } else if (criterio.getDescricao().compareToIgnoreCase(criterioCadastrado.getDescricao()) != 0) { | |
| 257 | 256 | alteracao = true; |
| 258 | 257 | } else if (criterio.getTipoTeste().getId().compareTo(criterioCadastrado.getTipoTeste().getId())!=0) { |
| 259 | 258 | alteracao = true; | ... | ... |
Desenvolvimento/Codificacao/e-Selo/src/main/java/br/com/eselo/controller/FaixaController.java
| ... | ... | @@ -144,7 +144,7 @@ public class FaixaController { |
| 144 | 144 | criarNovoParametroAvaliacao(faixas, ParametroCalculoController.MODO_ADD); |
| 145 | 145 | |
| 146 | 146 | result.include("mensagem", Messages.getString("faixas.mensagem.salva")); |
| 147 | - result.redirectTo(ParametroCalculoController.class).index(1); | |
| 147 | + result.redirectTo(CriteriosController.class).form(criterio.getId()); | |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | @Put("/faixas") |
| ... | ... | @@ -153,29 +153,36 @@ public class FaixaController { |
| 153 | 153 | Faixa faixaCadastrada = dao.load(faixa.getId()); |
| 154 | 154 | |
| 155 | 155 | Criterio criterio = daoCriterio.load(faixa.getCriterio().getId()); |
| 156 | + | |
| 157 | + result.include("criterioId", criterio.getId()); | |
| 158 | + result.include("criterio", criterio); | |
| 159 | + result.include("parametroCalculo", criterio.getRecomendacao().getParametroCalculo()); | |
| 160 | + | |
| 156 | 161 | faixa.setCriterio(criterio); |
| 157 | 162 | |
| 158 | 163 | validarFaixa(faixa); |
| 159 | 164 | |
| 160 | 165 | validator.onErrorRedirectTo(FaixaController.class).form(faixaCadastrada.getId()); |
| 161 | 166 | |
| 162 | - faixaCadastrada.setCriterio(faixa.getCriterio()); | |
| 163 | - faixaCadastrada.setFaixaInicio(faixa.getFaixaInicio()); | |
| 164 | - faixaCadastrada.setFaixaFim(faixa.getFaixaFim()); | |
| 165 | - | |
| 166 | - List<Faixa> faixas = new ArrayList<Faixa>(); | |
| 167 | - faixas.add(faixaCadastrada); | |
| 168 | - | |
| 169 | - | |
| 170 | 167 | if(validarAtualizacaoFaixa(faixa)){ |
| 168 | + faixaCadastrada.setCriterio(faixa.getCriterio()); | |
| 169 | + faixaCadastrada.setFaixaInicio(faixa.getFaixaInicio()); | |
| 170 | + faixaCadastrada.setFaixaFim(faixa.getFaixaFim()); | |
| 171 | + faixaCadastrada.setDescricao(faixa.getDescricao()); | |
| 172 | + faixaCadastrada.setPercentualConformidade(faixa.getPercentualConformidade()); | |
| 173 | + | |
| 174 | + List<Faixa> faixas = new ArrayList<Faixa>(); | |
| 175 | + faixas.add(faixaCadastrada); | |
| 176 | + | |
| 171 | 177 | criarNovoParametroAvaliacao(faixas, ParametroCalculoController.MODO_EDIT); |
| 172 | 178 | result.include("mensagem", Messages.getString("faixas.mensagem.alterada")); |
| 173 | 179 | }else{ |
| 180 | + faixaCadastrada.setDescricao(faixa.getDescricao()); | |
| 181 | + dao.update(faixaCadastrada); | |
| 174 | 182 | result.include("mensagem", "Nenhum campo foi alterado."); |
| 175 | 183 | } |
| 176 | 184 | |
| 177 | - result.redirectTo(ParametroCalculoController.class).index(1); | |
| 178 | - } | |
| 185 | + result.redirectTo(FaixaController.class).form(faixa.getId()); } | |
| 179 | 186 | |
| 180 | 187 | @Path("/faixas/delete/{id}") |
| 181 | 188 | @Restrito(descricao = "CONFORMIDADES_EXCLUIR") |
| ... | ... | @@ -226,21 +233,23 @@ public class FaixaController { |
| 226 | 233 | } |
| 227 | 234 | } |
| 228 | 235 | |
| 229 | - private boolean validarAtualizacaoFaixa(Criterio criterio) { | |
| 236 | + private boolean validarAtualizacaoFaixa(Faixa faixa) { | |
| 230 | 237 | |
| 231 | 238 | boolean alteracao = false; |
| 232 | 239 | |
| 233 | - Criterio criterioCadastrado = dao.load(criterio.getId()); | |
| 240 | + Faixa faixaCadastrada = dao.load(faixa.getId()); | |
| 234 | 241 | |
| 235 | - if (criterio.getNumeroCriterio().compareTo(criterioCadastrado.getNumeroCriterio())!=0) { | |
| 242 | + if (faixa.getFaixa().compareTo(faixaCadastrada.getFaixa())!=0) { | |
| 236 | 243 | alteracao = true; |
| 237 | - } else if (criterio.getPeso().compareTo(criterioCadastrado.getPeso()) !=0) { | |
| 244 | + } else if (faixa.getDescricao().compareToIgnoreCase(faixaCadastrada.getDescricao()) != 0) { | |
| 238 | 245 | alteracao = true; |
| 239 | - } else if (criterio.getDescricao().compareTo(criterio.getDescricao()) != 0) { | |
| 246 | + } else if (faixa.getFaixaInicio().compareTo(faixaCadastrada.getFaixaInicio())!=0) { | |
| 240 | 247 | alteracao = true; |
| 241 | - } else if (criterio.getTipoTeste().getId().compareTo(criterioCadastrado.getTipoTeste().getId())!=0) { | |
| 248 | + } else if (faixa.getFaixaFim().compareTo(faixaCadastrada.getFaixaFim()) !=0) { | |
| 242 | 249 | alteracao = true; |
| 243 | - } | |
| 250 | + } else if (faixa.getPercentualConformidade().compareTo(faixaCadastrada.getPercentualConformidade()) !=0) { | |
| 251 | + alteracao = true; | |
| 252 | + } | |
| 244 | 253 | |
| 245 | 254 | return alteracao; |
| 246 | 255 | } | ... | ... |
Desenvolvimento/Codificacao/e-Selo/src/main/java/br/com/eselo/controller/ParametroCalculoController.java
| ... | ... | @@ -27,7 +27,6 @@ import br.com.caelum.vraptor.Put; |
| 27 | 27 | import br.com.caelum.vraptor.Resource; |
| 28 | 28 | import br.com.caelum.vraptor.Result; |
| 29 | 29 | import br.com.caelum.vraptor.Validator; |
| 30 | -import br.com.caelum.vraptor.http.VRaptorRequest; | |
| 31 | 30 | import br.com.caelum.vraptor.ioc.spring.VRaptorRequestHolder; |
| 32 | 31 | import br.com.caelum.vraptor.validator.ValidationMessage; |
| 33 | 32 | import br.com.eselo.annotations.Restrito; | ... | ... |
Desenvolvimento/Codificacao/e-Selo/src/main/java/br/com/eselo/controller/RecomendacaoController.java
| ... | ... | @@ -15,7 +15,6 @@ import br.com.eselo.component.CopiadorParametroCalculo; |
| 15 | 15 | import br.com.eselo.component.UsuarioWeb; |
| 16 | 16 | import br.com.eselo.dao.ParametroCalculoDAO; |
| 17 | 17 | import br.com.eselo.dao.RecomendacaoDAO; |
| 18 | -import br.com.eselo.model.Criterio; | |
| 19 | 18 | import br.com.eselo.model.ParametroCalculo; |
| 20 | 19 | import br.com.eselo.model.Recomendacao; |
| 21 | 20 | |
| ... | ... | @@ -83,11 +82,6 @@ public class RecomendacaoController { |
| 83 | 82 | @Restrito(descricao = "RECOMENDACAO_ATUALIZAR") |
| 84 | 83 | public void atualizar(Recomendacao recomendacao) { |
| 85 | 84 | Recomendacao recomendacaoCadastrada = dao.load(recomendacao.getId()); |
| 86 | - recomendacaoCadastrada.setNumeroRecomendacao(recomendacao | |
| 87 | - .getNumeroRecomendacao()); | |
| 88 | - recomendacaoCadastrada.setDescricao(recomendacao.getDescricao()); | |
| 89 | - recomendacaoCadastrada.setPeso(recomendacao.getPeso()); | |
| 90 | - recomendacao.setCriterios(recomendacaoCadastrada.getCriterios()); | |
| 91 | 85 | |
| 92 | 86 | validarRecomendacao(recomendacao); |
| 93 | 87 | |
| ... | ... | @@ -96,12 +90,14 @@ public class RecomendacaoController { |
| 96 | 90 | |
| 97 | 91 | if(validarAtualizacaoRecomendacao(recomendacao)){ |
| 98 | 92 | criarNovoParametroAvaliacao(recomendacao,ParametroCalculoController.MODO_EDIT); |
| 99 | - result.include("mensagem", "Recomendação salvo com sucesso."); | |
| 93 | + result.include("mensagem", "Recomendação salva com sucesso."); | |
| 100 | 94 | }else{ |
| 95 | + recomendacaoCadastrada.setDescricao(recomendacao.getDescricao()); | |
| 96 | + dao.update(recomendacaoCadastrada); | |
| 101 | 97 | result.include("mensagem", "Nenhum campo foi alterado."); |
| 102 | 98 | } |
| 103 | 99 | |
| 104 | - result.redirectTo(ParametroCalculoController.class).index(1); | |
| 100 | + result.redirectTo(RecomendacaoController.class).form(recomendacao.getId()); | |
| 105 | 101 | } |
| 106 | 102 | |
| 107 | 103 | @Path("/recomendacao/delete/{id}") |
| ... | ... | @@ -193,19 +189,17 @@ public class RecomendacaoController { |
| 193 | 189 | |
| 194 | 190 | } |
| 195 | 191 | |
| 196 | - private boolean validarAtualizacaoRecomendacao(Criterio criterio) { | |
| 192 | + private boolean validarAtualizacaoRecomendacao(Recomendacao recomendacao) { | |
| 197 | 193 | |
| 198 | 194 | boolean alteracao = false; |
| 199 | 195 | |
| 200 | - Criterio criterioCadastrado = dao.load(criterio.getId()); | |
| 196 | + Recomendacao recomendacaoCadastrada = dao.load(recomendacao.getId()); | |
| 201 | 197 | |
| 202 | - if (criterio.getNumeroCriterio().compareTo(criterioCadastrado.getNumeroCriterio())!=0) { | |
| 203 | - alteracao = true; | |
| 204 | - } else if (criterio.getPeso().compareTo(criterioCadastrado.getPeso()) !=0) { | |
| 198 | + if (recomendacao.getNumeroRecomendacao().compareTo(recomendacaoCadastrada.getNumeroRecomendacao())!=0) { | |
| 205 | 199 | alteracao = true; |
| 206 | - } else if (criterio.getDescricao().compareTo(criterio.getDescricao()) != 0) { | |
| 200 | + } else if (recomendacao.getPeso().compareTo(recomendacaoCadastrada.getPeso()) !=0) { | |
| 207 | 201 | alteracao = true; |
| 208 | - } else if (criterio.getTipoTeste().getId().compareTo(criterioCadastrado.getTipoTeste().getId())!=0) { | |
| 202 | + } else if (recomendacao.getDescricao().compareToIgnoreCase(recomendacaoCadastrada.getDescricao()) != 0) { | |
| 209 | 203 | alteracao = true; |
| 210 | 204 | } |
| 211 | 205 | ... | ... |