Commit 2ed2645856f332aee56b195f155dd7133f5668d9

Authored by 96409975520
1 parent e8624499
Exists in master

Criação do painel e criação do orgão.

WebContent/WEB-INF/jsp/painel/painel.jsp
... ... @@ -27,10 +27,17 @@
27 27 </h1>
28 28 </div>
29 29 </div>
  30 +
30 31 <div>
31   -
  32 +
32 33 <fieldset>
33 34 <legend>Dados Acessibilidade</legend>
  35 +
  36 + <label>Total de solicitações: <span>${totalSolicitacoes}</span></label><br>
  37 + <label>Total de Relatório respondido: <span>${totalRelatorioRespondido}</span></label><br>
  38 + <label>Total de Relatório anexado: <span>${totalRelatorioAnexado}</span></label><br>
  39 + <label>Total de Plano de Trabalho anexado: <span>${totalPlanoTrabalhoAnexado}</span></label><br>
  40 + <label>Total de Relatório enviado à PFDC/MPF: <span>${totalRelatorioEnviado}</span></label><br>
34 41 <label>1) O Órgão
35 42 tem conhecimento da legislação que envolve o tema "acessibilidade"
36 43 bem como suas implicações?</label>
... ... @@ -120,7 +127,7 @@
120 127 <p><strong>Nota ASES (maior que 60% e menor ou igual 70%): ${notaAsesMaior_60_menorIgual_70 }</strong></p>
121 128 <p><strong>Nota ASES (maior que 70% e menor ou igual 80%): ${notaAsesMaior_70_menorIgual_80 }</strong></p>
122 129 <p><strong>Nota ASES (maior que 80% e menor ou igual 90%): ${notaAsesMaior_80_menorIgual_90 }</strong></p>
123   -<p><strong>Nota ASES (maior que 90% e menor ou igual 100%): ${notaAsesMaior_90_menor_100 }</strong></p>
  130 +<p><strong>Nota ASES (maior que 90% e menor 100%): ${notaAsesMaior_90_menor_100 }</strong></p>
124 131 <p><strong>Nota ASES (igual a 100%): ${notaAsesIgual_100 }</strong></p>
125 132  
126 133  
... ...
WebContent/WEB-INF/jsp/questionario/listaQuestionario.jsp
... ... @@ -99,7 +99,13 @@
99 99 ${relatorioAnex == 'nao'?'selected=\"selected\"':''}>Não</option>
100 100 </select>
101 101 <br><br>
102   -
  102 + <label for="statusRelatorio">Relatório Enviados ao MP:</label>
  103 + <select id="relatorioEnviado" name="relatorioEnviado">
  104 + <option value="todos" ${relatorioEnviado == ''?'selected=\"selected\"':''}>Todos</option>
  105 + <option value="sim" ${relatorioEnv == 'sim'?'selected=\"selected\"':''}>Sim</option>
  106 + <option value="nao" ${relatorioEnv == 'nao'?'selected=\"selected\"':''}>Não</option>
  107 + </select>
  108 + <br><br>
103 109 <label for="nomeOrgao">Nome do Órgao que contenha:</label>
104 110 <input type="text" id="nomeOrgao" name="nomeOrgao" size="70"
105 111 value="${nomeOrgao }">
... ...
WebContent/WEB-INF/jsp/questionario/questionario.jsp
... ... @@ -35,8 +35,14 @@ table, th, td {
35 35  
36 36 <label for="autorizacao">Senha autorização: </label> <input
37 37 type="password" id="autorizacao" name="autorizacao"><br>
38   - <br> <label for="noOrgao">Órgão: </label> <input type="text"
39   - id="noOrgao" name="noOrgao" size="70"><br>
  38 + <br> <label for="idOrgao">Órgão: </label>
  39 + <select id="idOrgao" name="idOrgao">
  40 + <c:forEach items="${lsOrgao}" var="item">
  41 + <option value="${item.idOrgao }">${item.nomeOrgao }</option>
  42 + </c:forEach>
  43 + </select>
  44 + <!-- <input type="text"
  45 + id="noOrgao" name="noOrgao" size="70">--><br>
40 46 <br> <label for="nomeResponsavel">Responsável: </label> <input
41 47 type="text" id="nomeResponsavel" name="nomeResponsavel" size="65"><br>
42 48 <br> <label for="cargoResponsavel">Cargo: </label> <input
... ...
src/br/com/controller/PainelController.java
... ... @@ -2,6 +2,8 @@ package br.com.controller;
2 2  
3 3 import java.sql.ResultSet;
4 4 import java.sql.SQLException;
  5 +import java.util.ArrayList;
  6 +import java.util.List;
5 7  
6 8 import javax.servlet.ServletContext;
7 9  
... ... @@ -10,6 +12,11 @@ import br.com.caelum.vraptor.Resource;
10 12 import br.com.caelum.vraptor.Result;
11 13 import br.com.caelum.vraptor.Validator;
12 14 import br.com.dao.PainelDao;
  15 +import br.com.dao.QuestionarioDao;
  16 +import br.com.dao.RespostaQuestionarioDao;
  17 +import br.com.model.entity.AmostragemSiteQuestionario;
  18 +import br.com.model.entity.Questionario;
  19 +import br.com.model.entity.RespostaQuestionario;
13 20  
14 21 @Resource
15 22 public class PainelController {
... ... @@ -27,105 +34,582 @@ public class PainelController {
27 34 @Path("/painel")
28 35 public void painel() {
29 36  
  37 + QuestionarioDao questionarioDao = new QuestionarioDao();
  38 +
  39 + ResultSet rset = questionarioDao.retornarQuestionarioEnviados(path);
  40 + RespostaQuestionarioDao respostaQuestionarioDao = new RespostaQuestionarioDao();
  41 +
  42 + List<RespostaQuestionario> lsRespostaQuestionario;
  43 +
  44 +
  45 + //pergunta 1
  46 + int pergunta1_2 = 0;
  47 + int pergunta1_3 = 0;
  48 + int pergunta1_4 = 0;
  49 +
  50 + //pergunta 2
  51 + int pergunta2_2 = 0;
  52 + int pergunta2_3 = 0;
  53 +
  54 + //pergunta 3
  55 + int pergunta3_2 = 0;
  56 + int pergunta3_5 = 0;
  57 + int pergunta3_6 = 0;
  58 +
  59 + //pergunta 4
  60 + int pergunta4_7 = 0;
  61 + int pergunta4_8 = 0;
  62 + int pergunta4_9 = 0;
  63 + int pergunta4_10 = 0;
  64 +
  65 + //pergunta 5
  66 + int pergunta5_11 = 0;
  67 + int pergunta5_12 = 0;
  68 + int pergunta5_13 = 0;
  69 + int pergunta5_3 = 0;
  70 +
  71 + //pergunta 6
  72 + int pergunta6_14 = 0;
  73 + int pergunta6_15 = 0;
  74 + int pergunta6_3 = 0;
  75 +
  76 + //pergunta 7
  77 + int pergunta7_2 = 0;
  78 + int pergunta7_3 = 0;
  79 +
  80 + //pergunta 8
  81 + int pergunta8_16 = 0;
  82 + int pergunta8_17 = 0;
  83 + int pergunta8_18 = 0;
  84 + int pergunta8_19 = 0;
  85 +
  86 + //pergunta 9
  87 + int pergunta9_20 = 0;
  88 + int pergunta9_21 = 0;
  89 + int pergunta9_22 = 0;
  90 + int pergunta9_23 = 0;
  91 + int pergunta9_24 = 0;
  92 + int pergunta9_25 = 0;
  93 + int pergunta9_26 = 0;
  94 + int pergunta9_27 = 0;
  95 + int pergunta9_28 = 0;
  96 + int pergunta9_29 = 0;
  97 + int pergunta9_30 = 0;
  98 + int pergunta9_31 = 0;
  99 + int pergunta9_32 = 0;
  100 + int pergunta9_33 = 0;
  101 + int pergunta9_34 = 0;
  102 +
  103 + //Notas Ases
  104 + Double notaConvertidaAses;
  105 + String nota = null;
  106 + int notaAsesMenorIgual_10 = 0;
  107 + int notaAsesMaior_10_menorIgual_20 = 0;
  108 + int notaAsesMaior_20_menorIgual_30 = 0;
  109 + int notaAsesMaior_30_menorIgual_40 = 0;
  110 + int notaAsesMaior_40_menorIgual_50 = 0;
  111 + int notaAsesMaior_50_menorIgual_60 = 0;
  112 + int notaAsesMaior_60_menorIgual_70 = 0;
  113 + int notaAsesMaior_70_menorIgual_80 = 0;
  114 + int notaAsesMaior_80_menorIgual_90 = 0;
  115 + int notaAsesMaior_90_menor_100 = 0;
  116 + int notaAsesIgual_100 = 0;
  117 + int totalAmbientes = 0;
  118 +
  119 + //Notas AccessMonitor
  120 + int notaAccessMonitorMenorIgual_1 = 0;
  121 + int notaAccessMonitorMaior_1_menorIgual_2 = 0;
  122 + int notaAccessMonitorMaior_2_menorIgual_3 = 0;
  123 + int notaAccessMonitorMaior_3_menorIgual_4 = 0;
  124 + int notaAccessMonitorMaior_4_menorIgual_5 = 0;
  125 + int notaAccessMonitorMaior_5_menorIgual_6 = 0;
  126 + int notaAccessMonitorMaior_6_menorIgual_7 = 0;
  127 + int notaAccessMonitorMaior_7_menorIgual_8 = 0;
  128 + int notaAccessMonitorMaior_8_menorIgual_9 = 0;
  129 + int notaAccessMonitorMaior_9_menor_10 = 0;
  130 + int notaAccessMonitorIgual_10 = 0;
  131 + Double notaConvertidaAccessMonitor;
  132 +
  133 +
  134 + //pergunta 11
  135 + int pergunta11_50 = 0;
  136 + int pergunta11_51 = 0;
  137 + int pergunta11_52 = 0;
  138 + int pergunta11_53 = 0;
  139 + int pergunta11_54 = 0;
  140 +
  141 + //pergunta 12
  142 + int pergunta12_65 = 0;
  143 + int pergunta12_66 = 0;
  144 + int pergunta12_67 = 0;
  145 + int pergunta12_68 = 0;
  146 +
  147 + //pergunta 13
  148 + int pergunta13_2 = 0;
  149 + int pergunta13_55 = 0;
  150 + int pergunta13_3 = 0;
  151 +
  152 + //pergunta 14
  153 + int pergunta14_20 = 0;
  154 + int pergunta14_56 = 0;
  155 + int pergunta14_57 = 0;
  156 + int pergunta14_58 = 0;
  157 + int pergunta14_59 = 0;
  158 + int pergunta14_60 = 0;
  159 + int pergunta14_61 = 0;
  160 + int pergunta14_62 = 0;
  161 + int pergunta14_69 = 0;
  162 + int pergunta14_34 = 0;
  163 +
  164 +
  165 + try {
  166 + while (rset.next()) {
  167 + lsRespostaQuestionario = new ArrayList<RespostaQuestionario>();
  168 +
  169 + lsRespostaQuestionario = respostaQuestionarioDao.retornarRespostaQuestionarioPorQuestionario(path,
  170 + rset.getInt("id_questionario"));
  171 +
  172 + for (RespostaQuestionario respostaQuestionario : lsRespostaQuestionario) {
  173 +
  174 + switch (respostaQuestionario.getPergunta().getIdPergunta()) {
  175 + case 7:
  176 + if(respostaQuestionario.getOpcaoResposta().getIdOpcaoResposta() == 2)
  177 + {
  178 + pergunta1_2++;
  179 + }else if(respostaQuestionario.getOpcaoResposta().getIdOpcaoResposta() == 3)
  180 + {
  181 + pergunta1_3++;
  182 + }else if(respostaQuestionario.getOpcaoResposta().getIdOpcaoResposta() == 4)
  183 + {
  184 + pergunta1_4++;
  185 + }
  186 + break;
  187 +
  188 + case 8:
  189 + if(respostaQuestionario.getOpcaoResposta().getIdOpcaoResposta() == 2)
  190 + {
  191 + pergunta2_2++;
  192 + }else if(respostaQuestionario.getOpcaoResposta().getIdOpcaoResposta() == 3)
  193 + {
  194 + pergunta2_3++;
  195 + }
  196 + break;
  197 + case 10:
  198 + if(respostaQuestionario.getOpcaoResposta().getIdOpcaoResposta() == 2)
  199 + {
  200 + pergunta3_2++;
  201 + }else if(respostaQuestionario.getOpcaoResposta().getIdOpcaoResposta() == 5)
  202 + {
  203 + pergunta3_5++;
  204 + }else if(respostaQuestionario.getOpcaoResposta().getIdOpcaoResposta() == 6)
  205 + {
  206 + pergunta3_6++;
  207 + }
  208 + break;
  209 + case 11:
  210 + if(respostaQuestionario.getOpcaoResposta().getIdOpcaoResposta() == 7)
  211 + {
  212 + pergunta4_7++;
  213 + }else if(respostaQuestionario.getOpcaoResposta().getIdOpcaoResposta() == 8)
  214 + {
  215 + pergunta4_8++;
  216 + }else if(respostaQuestionario.getOpcaoResposta().getIdOpcaoResposta() == 9)
  217 + {
  218 + pergunta4_9++;
  219 + }else if(respostaQuestionario.getOpcaoResposta().getIdOpcaoResposta() == 10)
  220 + {
  221 + pergunta4_10++;
  222 + }
  223 + break;
  224 + case 12:
  225 + if(respostaQuestionario.getOpcaoResposta().getIdOpcaoResposta() == 11)
  226 + {
  227 + pergunta5_11++;
  228 + }else if(respostaQuestionario.getOpcaoResposta().getIdOpcaoResposta() == 12)
  229 + {
  230 + pergunta5_12++;
  231 + }else if(respostaQuestionario.getOpcaoResposta().getIdOpcaoResposta() == 13)
  232 + {
  233 + pergunta5_13++;
  234 + }else if(respostaQuestionario.getOpcaoResposta().getIdOpcaoResposta() == 3)
  235 + {
  236 + pergunta5_3++;
  237 + }
  238 + break;
  239 + case 14:
  240 + if(respostaQuestionario.getOpcaoResposta().getIdOpcaoResposta() == 14)
  241 + {
  242 + pergunta6_14++;
  243 + }else if(respostaQuestionario.getOpcaoResposta().getIdOpcaoResposta() == 15)
  244 + {
  245 + pergunta6_15++;
  246 + }else if(respostaQuestionario.getOpcaoResposta().getIdOpcaoResposta() == 3)
  247 + {
  248 + pergunta6_3++;
  249 + }
  250 + break;
  251 + case 15:
  252 + if(respostaQuestionario.getOpcaoResposta().getIdOpcaoResposta() == 2)
  253 + {
  254 + pergunta7_2++;
  255 + }else if(respostaQuestionario.getOpcaoResposta().getIdOpcaoResposta() == 3)
  256 + {
  257 + pergunta7_3++;
  258 + }
  259 + break;
  260 + case 16:
  261 + if(respostaQuestionario.getOpcaoResposta().getIdOpcaoResposta() == 16)
  262 + {
  263 + pergunta8_16++;
  264 + }else if(respostaQuestionario.getOpcaoResposta().getIdOpcaoResposta() == 17)
  265 + {
  266 + pergunta8_17++;
  267 + }else if(respostaQuestionario.getOpcaoResposta().getIdOpcaoResposta() == 18)
  268 + {
  269 + pergunta8_18++;
  270 + }else if(respostaQuestionario.getOpcaoResposta().getIdOpcaoResposta() == 19)
  271 + {
  272 + pergunta8_19++;
  273 + }
  274 + break;
  275 + case 17:
  276 + if(respostaQuestionario.getOpcaoResposta().getIdOpcaoResposta() == 20)
  277 + {
  278 + pergunta9_20++;
  279 + }else if(respostaQuestionario.getOpcaoResposta().getIdOpcaoResposta() == 21)
  280 + {
  281 + pergunta9_21++;
  282 + }else if(respostaQuestionario.getOpcaoResposta().getIdOpcaoResposta() == 22)
  283 + {
  284 + pergunta9_22++;
  285 + }else if(respostaQuestionario.getOpcaoResposta().getIdOpcaoResposta() == 23)
  286 + {
  287 + pergunta9_23++;
  288 + }else if(respostaQuestionario.getOpcaoResposta().getIdOpcaoResposta() == 24)
  289 + {
  290 + pergunta9_24++;
  291 + }else if(respostaQuestionario.getOpcaoResposta().getIdOpcaoResposta() == 25)
  292 + {
  293 + pergunta9_25++;
  294 + }else if(respostaQuestionario.getOpcaoResposta().getIdOpcaoResposta() == 26)
  295 + {
  296 + pergunta9_26++;
  297 + }else if(respostaQuestionario.getOpcaoResposta().getIdOpcaoResposta() == 27)
  298 + {
  299 + pergunta9_27++;
  300 + }else if(respostaQuestionario.getOpcaoResposta().getIdOpcaoResposta() == 28)
  301 + {
  302 + pergunta9_28++;
  303 + }else if(respostaQuestionario.getOpcaoResposta().getIdOpcaoResposta() == 29)
  304 + {
  305 + pergunta9_29++;
  306 + }else if(respostaQuestionario.getOpcaoResposta().getIdOpcaoResposta() == 30)
  307 + {
  308 + pergunta9_30++;
  309 + }else if(respostaQuestionario.getOpcaoResposta().getIdOpcaoResposta() == 31)
  310 + {
  311 + pergunta9_31++;
  312 + }else if(respostaQuestionario.getOpcaoResposta().getIdOpcaoResposta() == 32)
  313 + {
  314 + pergunta9_32++;
  315 + }else if(respostaQuestionario.getOpcaoResposta().getIdOpcaoResposta() == 33)
  316 + {
  317 + pergunta9_33++;
  318 + }else if(respostaQuestionario.getOpcaoResposta().getIdOpcaoResposta() == 34)
  319 + {
  320 + pergunta9_34++;
  321 + }
  322 + break;
  323 + case 19:
  324 + totalAmbientes++;
  325 + //Notas Ases
  326 + if(respostaQuestionario.getOpcaoResposta().getIdOpcaoResposta() == 63)
  327 + {
  328 + notaConvertidaAses = Double.parseDouble(respostaQuestionario.getTextoResposta().replace(",", "."));
  329 +
  330 + if(notaConvertidaAses <= 10)
  331 + {
  332 + notaAsesMenorIgual_10++;
  333 +
  334 + }else if(notaConvertidaAses > 10 && notaConvertidaAses <= 20)
  335 + {
  336 + notaAsesMaior_10_menorIgual_20++;
  337 +
  338 + }else if(notaConvertidaAses > 20 && notaConvertidaAses <= 30)
  339 + {
  340 + notaAsesMaior_20_menorIgual_30++;
  341 +
  342 + }else if(notaConvertidaAses > 30 && notaConvertidaAses <= 40)
  343 + {
  344 + notaAsesMaior_30_menorIgual_40++;
  345 +
  346 + }else if(notaConvertidaAses > 40 && notaConvertidaAses <= 50)
  347 + {
  348 + notaAsesMaior_40_menorIgual_50++;
  349 +
  350 + }else if(notaConvertidaAses > 50 && notaConvertidaAses <= 60)
  351 + {
  352 + notaAsesMaior_50_menorIgual_60++;
  353 +
  354 + }else if(notaConvertidaAses > 60 && notaConvertidaAses <= 70)
  355 + {
  356 + notaAsesMaior_60_menorIgual_70++;
  357 +
  358 + }else if(notaConvertidaAses > 70 && notaConvertidaAses <= 80)
  359 + {
  360 + notaAsesMaior_70_menorIgual_80++;
  361 +
  362 + }else if(notaConvertidaAses > 80 && notaConvertidaAses <= 90)
  363 + {
  364 + notaAsesMaior_80_menorIgual_90++;
  365 +
  366 + }else if(notaConvertidaAses > 90 && notaConvertidaAses < 100)
  367 + {
  368 + notaAsesMaior_90_menor_100++;
  369 +
  370 + }else if(notaConvertidaAses == 100)
  371 + {
  372 + notaAsesIgual_100++;
  373 + }
  374 +
  375 +
  376 + }else if(respostaQuestionario.getOpcaoResposta().getIdOpcaoResposta() == 64)
  377 + {
  378 + //Notas AccessMonitor
  379 + notaConvertidaAccessMonitor = Double.parseDouble(respostaQuestionario.getTextoResposta().replace(",", "."));
  380 +
  381 + if(notaConvertidaAccessMonitor <= 1)
  382 + {
  383 + notaAccessMonitorMenorIgual_1++;
  384 +
  385 + }else if(notaConvertidaAccessMonitor > 2 && notaConvertidaAccessMonitor <= 3)
  386 + {
  387 + notaAccessMonitorMaior_1_menorIgual_2++;
  388 +
  389 + }else if(notaConvertidaAccessMonitor > 3 && notaConvertidaAccessMonitor <= 4)
  390 + {
  391 + notaAccessMonitorMaior_3_menorIgual_4++;
  392 +
  393 + }else if(notaConvertidaAccessMonitor > 4 && notaConvertidaAccessMonitor <= 5)
  394 + {
  395 + notaAccessMonitorMaior_4_menorIgual_5++;
  396 +
  397 + }else if(notaConvertidaAccessMonitor > 5 && notaConvertidaAccessMonitor <= 6)
  398 + {
  399 + notaAccessMonitorMaior_5_menorIgual_6++;
  400 +
  401 + }else if(notaConvertidaAccessMonitor > 6 && notaConvertidaAccessMonitor <= 7)
  402 + {
  403 + notaAccessMonitorMaior_6_menorIgual_7++;
  404 +
  405 + }else if(notaConvertidaAccessMonitor > 7 && notaConvertidaAccessMonitor <= 8)
  406 + {
  407 + notaAccessMonitorMaior_7_menorIgual_8++;
  408 +
  409 + }else if(notaConvertidaAccessMonitor > 8 && notaConvertidaAccessMonitor <= 9)
  410 + {
  411 + notaAccessMonitorMaior_8_menorIgual_9++;
  412 +
  413 + }else if(notaConvertidaAccessMonitor > 9 && notaConvertidaAccessMonitor < 10)
  414 + {
  415 + notaAccessMonitorMaior_9_menor_10++;
  416 +
  417 + }else if(notaConvertidaAccessMonitor == 10)
  418 + {
  419 + notaAccessMonitorIgual_10++;
  420 + }
  421 + }
  422 + break;
  423 + case 21:
  424 + if(respostaQuestionario.getOpcaoResposta().getIdOpcaoResposta() == 50)
  425 + {
  426 + pergunta11_50++;
  427 + }else if(respostaQuestionario.getOpcaoResposta().getIdOpcaoResposta() == 51)
  428 + {
  429 + pergunta11_51++;
  430 + }else if(respostaQuestionario.getOpcaoResposta().getIdOpcaoResposta() == 52)
  431 + {
  432 + pergunta11_52++;
  433 + }else if(respostaQuestionario.getOpcaoResposta().getIdOpcaoResposta() == 53)
  434 + {
  435 + pergunta11_53++;
  436 + }else if(respostaQuestionario.getOpcaoResposta().getIdOpcaoResposta() == 54)
  437 + {
  438 + pergunta11_54++;
  439 + }
  440 +
  441 + break;
  442 + case 22:
  443 + if(respostaQuestionario.getOpcaoResposta().getIdOpcaoResposta() == 65)
  444 + {
  445 + pergunta12_65++;
  446 + }else if(respostaQuestionario.getOpcaoResposta().getIdOpcaoResposta() == 66)
  447 + {
  448 + pergunta12_66++;
  449 + }else if(respostaQuestionario.getOpcaoResposta().getIdOpcaoResposta() == 67)
  450 + {
  451 + pergunta12_67++;
  452 + }else if(respostaQuestionario.getOpcaoResposta().getIdOpcaoResposta() == 68)
  453 + {
  454 + pergunta12_68++;
  455 + }
  456 + break;
  457 + case 23:
  458 + if(respostaQuestionario.getOpcaoResposta().getIdOpcaoResposta() == 2)
  459 + {
  460 + pergunta13_2++;
  461 + }else if(respostaQuestionario.getOpcaoResposta().getIdOpcaoResposta() == 55)
  462 + {
  463 + pergunta13_55++;
  464 + }else if(respostaQuestionario.getOpcaoResposta().getIdOpcaoResposta() == 3)
  465 + {
  466 + pergunta13_3++;
  467 + }
  468 + break;
  469 + case 24:
  470 + if(respostaQuestionario.getOpcaoResposta().getIdOpcaoResposta() == 20)
  471 + {
  472 + pergunta14_20++;
  473 + }else if(respostaQuestionario.getOpcaoResposta().getIdOpcaoResposta() == 56)
  474 + {
  475 + pergunta14_56++;
  476 + }else if(respostaQuestionario.getOpcaoResposta().getIdOpcaoResposta() == 57)
  477 + {
  478 + pergunta14_57++;
  479 + }else if(respostaQuestionario.getOpcaoResposta().getIdOpcaoResposta() == 58)
  480 + {
  481 + pergunta14_58++;
  482 + }else if(respostaQuestionario.getOpcaoResposta().getIdOpcaoResposta() == 59)
  483 + {
  484 + pergunta14_59++;
  485 + }else if(respostaQuestionario.getOpcaoResposta().getIdOpcaoResposta() == 60)
  486 + {
  487 + pergunta14_60++;
  488 + }else if(respostaQuestionario.getOpcaoResposta().getIdOpcaoResposta() == 61)
  489 + {
  490 + pergunta14_61++;
  491 + }else if(respostaQuestionario.getOpcaoResposta().getIdOpcaoResposta() == 62)
  492 + {
  493 + pergunta14_62++;
  494 + }else if(respostaQuestionario.getOpcaoResposta().getIdOpcaoResposta() == 69)
  495 + {
  496 + pergunta14_69++;
  497 + }else if(respostaQuestionario.getOpcaoResposta().getIdOpcaoResposta() == 34)
  498 + {
  499 + pergunta14_34++;
  500 + }
  501 + break;
  502 + default:
  503 + break;
  504 + }
  505 +
  506 + }
  507 + }
  508 + } catch (NumberFormatException e) {
  509 + e.printStackTrace();
  510 + } catch (SQLException e) {
  511 + e.printStackTrace();
  512 + }
  513 +
30 514 PainelDao painelDao = new PainelDao();
31 515  
32 516 //pergunta 1
33   - result.include("pergunta1_2", painelDao.retornarTotalResposta(path, 7,2));
34   - result.include("pergunta1_4", painelDao.retornarTotalResposta(path, 7,4));
35   - result.include("pergunta1_3", painelDao.retornarTotalResposta(path, 7,3));
  517 + result.include("pergunta1_2", pergunta1_2);
  518 + result.include("pergunta1_4", pergunta1_4);
  519 + result.include("pergunta1_3", pergunta1_3);
36 520  
37 521 //pergunta 2
38   - result.include("pergunta2_2", painelDao.retornarTotalResposta(path, 8,2));
39   - result.include("pergunta2_3", painelDao.retornarTotalResposta(path, 8,3));
  522 + result.include("pergunta2_2", pergunta2_2);
  523 + result.include("pergunta2_3", pergunta2_3);
40 524  
41 525 //pergunta 3
42   - result.include("pergunta3_2", painelDao.retornarTotalResposta(path, 10,2));
43   - result.include("pergunta3_5", painelDao.retornarTotalResposta(path, 10,5));
44   - result.include("pergunta3_6", painelDao.retornarTotalResposta(path, 10,6));
  526 + result.include("pergunta3_2", pergunta3_2);
  527 + result.include("pergunta3_5", pergunta3_5);
  528 + result.include("pergunta3_6", pergunta3_6);
45 529  
46 530 //pergunta 4
47   - result.include("pergunta4_7", painelDao.retornarTotalResposta(path, 11,7));
48   - result.include("pergunta4_8", painelDao.retornarTotalResposta(path, 11,8));
49   - result.include("pergunta4_9", painelDao.retornarTotalResposta(path, 11,9));
50   - result.include("pergunta4_10", painelDao.retornarTotalResposta(path, 11,10));
  531 + result.include("pergunta4_7", pergunta4_7);
  532 + result.include("pergunta4_8", pergunta4_8);
  533 + result.include("pergunta4_9", pergunta4_9);
  534 + result.include("pergunta4_10", pergunta4_10);
51 535  
52 536 //pergunta 5
53   - result.include("pergunta5_11", painelDao.retornarTotalResposta(path, 12,11));
54   - result.include("pergunta5_12", painelDao.retornarTotalResposta(path, 12,12));
55   - result.include("pergunta5_13", painelDao.retornarTotalResposta(path, 12,13));
56   - result.include("pergunta5_3", painelDao.retornarTotalResposta(path, 12,3));
  537 + result.include("pergunta5_11", pergunta5_11);
  538 + result.include("pergunta5_12", pergunta5_12);
  539 + result.include("pergunta5_13", pergunta5_13);
  540 + result.include("pergunta5_3", pergunta5_3);
57 541  
58 542 //pergunta 6
59   - result.include("pergunta6_14", painelDao.retornarTotalResposta(path, 14,14));
60   - result.include("pergunta6_15", painelDao.retornarTotalResposta(path, 14,15));
61   - result.include("pergunta6_3", painelDao.retornarTotalResposta(path, 14,3));
  543 + result.include("pergunta6_14", pergunta6_14);
  544 + result.include("pergunta6_15", pergunta6_15);
  545 + result.include("pergunta6_3", pergunta6_3);
62 546  
63 547 //pergunta 7
64   - result.include("pergunta7_2", painelDao.retornarTotalResposta(path, 15,2));
65   - result.include("pergunta7_3", painelDao.retornarTotalResposta(path, 15,3));
  548 + result.include("pergunta7_2", pergunta7_2);
  549 + result.include("pergunta7_3", pergunta7_3);
66 550  
67 551 //pergunta 8
68   - result.include("pergunta8_16", painelDao.retornarTotalResposta(path, 16,16));
69   - result.include("pergunta8_17", painelDao.retornarTotalResposta(path, 16,17));
70   - result.include("pergunta8_18", painelDao.retornarTotalResposta(path, 16,18));
71   - result.include("pergunta8_19", painelDao.retornarTotalResposta(path, 16,19));
  552 + result.include("pergunta8_16",pergunta8_16);
  553 + result.include("pergunta8_17", pergunta8_17);
  554 + result.include("pergunta8_18", pergunta8_18);
  555 + result.include("pergunta8_19", pergunta8_19);
72 556  
73 557 //pergunta 9
74   - result.include("pergunta9_20", painelDao.retornarTotalResposta(path, 17,20));
75   - result.include("pergunta9_21", painelDao.retornarTotalResposta(path, 17,21));
76   - result.include("pergunta9_22", painelDao.retornarTotalResposta(path, 17,22));
77   - result.include("pergunta9_23", painelDao.retornarTotalResposta(path, 17,23));
78   - result.include("pergunta9_24", painelDao.retornarTotalResposta(path, 17,24));
79   - result.include("pergunta9_25", painelDao.retornarTotalResposta(path, 17,25));
80   - result.include("pergunta9_26", painelDao.retornarTotalResposta(path, 17,26));
81   - result.include("pergunta9_27", painelDao.retornarTotalResposta(path, 17,27));
82   - result.include("pergunta9_28", painelDao.retornarTotalResposta(path, 17,28));
83   - result.include("pergunta9_29", painelDao.retornarTotalResposta(path, 17,29));
84   - result.include("pergunta9_30", painelDao.retornarTotalResposta(path, 17,30));
85   - result.include("pergunta9_31", painelDao.retornarTotalResposta(path, 17,31));
86   - result.include("pergunta9_32", painelDao.retornarTotalResposta(path, 17,32));
87   - result.include("pergunta9_33", painelDao.retornarTotalResposta(path, 17,33));
88   - result.include("pergunta9_34", painelDao.retornarTotalResposta(path, 17,34));
  558 + result.include("pergunta9_20", pergunta9_20);
  559 + result.include("pergunta9_21", pergunta9_21);
  560 + result.include("pergunta9_22", pergunta9_22);
  561 + result.include("pergunta9_23", pergunta9_23);
  562 + result.include("pergunta9_24", pergunta9_24);
  563 + result.include("pergunta9_25", pergunta9_25);
  564 + result.include("pergunta9_26", pergunta9_26);
  565 + result.include("pergunta9_27", pergunta9_27);
  566 + result.include("pergunta9_28", pergunta9_28);
  567 + result.include("pergunta9_29", pergunta9_29);
  568 + result.include("pergunta9_30", pergunta9_30);
  569 + result.include("pergunta9_31", pergunta9_31);
  570 + result.include("pergunta9_32", pergunta9_32);
  571 + result.include("pergunta9_33", pergunta9_33);
  572 + result.include("pergunta9_34", pergunta9_34);
89 573  
90 574  
91 575 //pergunta 10 NOTAS
92 576  
93 577  
94 578 //pergunta 11
95   - result.include("pergunta11_50", painelDao.retornarTotalResposta(path, 21,50));
96   - result.include("pergunta11_51", painelDao.retornarTotalResposta(path, 21,51));
97   - result.include("pergunta11_52", painelDao.retornarTotalResposta(path, 21,52));
98   - result.include("pergunta11_53", painelDao.retornarTotalResposta(path, 21,53));
99   - result.include("pergunta11_54", painelDao.retornarTotalResposta(path, 21,54));
  579 + result.include("pergunta11_50", pergunta11_50);
  580 + result.include("pergunta11_51", pergunta11_51);
  581 + result.include("pergunta11_52", pergunta11_52);
  582 + result.include("pergunta11_53", pergunta11_53);
  583 + result.include("pergunta11_54", pergunta11_54);
100 584  
101 585 //pergunta 12
102   - result.include("pergunta12_65", painelDao.retornarTotalResposta(path, 22,65));
103   - result.include("pergunta12_66", painelDao.retornarTotalResposta(path, 22,66));
104   - result.include("pergunta12_67", painelDao.retornarTotalResposta(path, 22,67));
105   - result.include("pergunta12_68", painelDao.retornarTotalResposta(path, 22,68));
  586 + result.include("pergunta12_65", pergunta12_65);
  587 + result.include("pergunta12_66", pergunta12_66);
  588 + result.include("pergunta12_67", pergunta12_67);
  589 + result.include("pergunta12_68", pergunta12_68);
106 590  
107 591 //pergunta 13
108   - result.include("pergunta13_2", painelDao.retornarTotalResposta(path, 23,2));
109   - result.include("pergunta13_55", painelDao.retornarTotalResposta(path, 23,55));
110   - result.include("pergunta13_3", painelDao.retornarTotalResposta(path, 23,3));
  592 + result.include("pergunta13_2", pergunta13_2);
  593 + result.include("pergunta13_55", pergunta13_55);
  594 + result.include("pergunta13_3", pergunta13_3);
111 595  
112 596 //pergunta 14
113   - result.include("pergunta14_20", painelDao.retornarTotalResposta(path, 24,20));
114   - result.include("pergunta14_56", painelDao.retornarTotalResposta(path, 24,56));
115   - result.include("pergunta14_57", painelDao.retornarTotalResposta(path, 24,57));
116   - result.include("pergunta14_58", painelDao.retornarTotalResposta(path, 24,58));
117   - result.include("pergunta14_59", painelDao.retornarTotalResposta(path, 24,59));
118   - result.include("pergunta14_60", painelDao.retornarTotalResposta(path, 24,60));
119   - result.include("pergunta14_61", painelDao.retornarTotalResposta(path, 24,61));
120   - result.include("pergunta14_62", painelDao.retornarTotalResposta(path, 24,62));
121   - result.include("pergunta14_69", painelDao.retornarTotalResposta(path, 24,69));
122   - result.include("pergunta14_34", painelDao.retornarTotalResposta(path, 24,34));
  597 + result.include("pergunta14_20", pergunta14_20);
  598 + result.include("pergunta14_56", pergunta14_56);
  599 + result.include("pergunta14_57", pergunta14_57);
  600 + result.include("pergunta14_58", pergunta14_58);
  601 + result.include("pergunta14_59", pergunta14_59);
  602 + result.include("pergunta14_60", pergunta14_60);
  603 + result.include("pergunta14_61", pergunta14_61);
  604 + result.include("pergunta14_62", pergunta14_62);
  605 + result.include("pergunta14_69", pergunta14_69);
  606 + result.include("pergunta14_34", pergunta14_34);
123 607  
124   - ResultSet rset = null;
  608 + //ResultSet rset = null;
125 609  
126 610 //Notas Ases
127   - rset = painelDao.retornarTotalNotas(path, 63);
128   - String nota = null;
  611 + //rset = painelDao.retornarTotalNotas(path, 63);
  612 + /*String nota = null;
129 613 int notaAsesMenorIgual_10 = 0;
130 614 int notaAsesMaior_10_menorIgual_20 = 0;
131 615 int notaAsesMaior_20_menorIgual_30 = 0;
... ... @@ -137,11 +621,11 @@ public class PainelController {
137 621 int notaAsesMaior_80_menorIgual_90 = 0;
138 622 int notaAsesMaior_90_menor_100 = 0;
139 623 int notaAsesIgual_100 = 0;
140   - int totalAmbientes = 0;
  624 + int totalAmbientes = 0;*/
  625 +
141 626  
142   - Double notaConvertidaAses;
143 627  
144   - if(rset != null)
  628 + /*if(rset != null)
145 629 {
146 630 try {
147 631 while (rset.next()) {
... ... @@ -196,7 +680,7 @@ public class PainelController {
196 680 } catch (SQLException e) {
197 681 e.printStackTrace();
198 682 }
199   - }
  683 + }*/
200 684  
201 685  
202 686 result.include("notaAsesMenorIgual_10", notaAsesMenorIgual_10);
... ... @@ -213,7 +697,7 @@ public class PainelController {
213 697 result.include("totalAmbientes", totalAmbientes);
214 698  
215 699 //Notas AccessMonitor
216   - rset = painelDao.retornarTotalNotas(path, 64);
  700 + /*rset = painelDao.retornarTotalNotas(path, 64);
217 701  
218 702 int notaAccessMonitorMenorIgual_1 = 0;
219 703 int notaAccessMonitorMaior_1_menorIgual_2 = 0;
... ... @@ -282,9 +766,10 @@ public class PainelController {
282 766 } catch (SQLException e) {
283 767 e.printStackTrace();
284 768 }
285   - }
286   -
  769 + }*/
  770 +
287 771  
  772 + result.include("totalRelatorioRespondido", painelDao.retornarTotalQuestionarioRespondido(path));
288 773 result.include("notaAccessMonitorMenorIgual_1", notaAccessMonitorMenorIgual_1);
289 774 result.include("notaAccessMonitorMaior_1_menorIgual_2", notaAccessMonitorMaior_1_menorIgual_2);
290 775 result.include("notaAccessMonitorMaior_2_menorIgual_3", notaAccessMonitorMaior_2_menorIgual_3);
... ... @@ -298,6 +783,45 @@ public class PainelController {
298 783 result.include("notaAccessMonitorMaior_9_menor_10", notaAccessMonitorMaior_9_menor_10);
299 784 result.include("notaAccessMonitorIgual_10", notaAccessMonitorIgual_10);
300 785  
  786 + listarRelatorioQuestionario();
  787 + }
  788 +
  789 +
  790 + private void listarRelatorioQuestionario()
  791 + {
  792 + QuestionarioDao questionarioDao = new QuestionarioDao();
  793 + List<Questionario> lsquestionario = new ArrayList<Questionario>();
  794 + lsquestionario = questionarioDao.retornarListaQuestionario(path);
  795 +
  796 +
  797 +
  798 + int planoTrabalhoAnexado = 0;
  799 + int relatorioAnexado = 0;
  800 + int relatorioEnviado = 0;
  801 +
  802 + for (Questionario questionario : lsquestionario) {
  803 +
  804 + if(questionario.isPlanoTrabalhoAnexado())
  805 + {
  806 + planoTrabalhoAnexado++;
  807 + }
  808 + if(questionario.isRelatorioAnexado())
  809 + {
  810 + relatorioAnexado++;
  811 + }
  812 + if(questionario.isFlagEnviado())
  813 + {
  814 + relatorioEnviado++;
  815 + }
  816 +
  817 + }
  818 +
  819 +
  820 + result.include("totalPlanoTrabalhoAnexado", planoTrabalhoAnexado);
  821 + result.include("totalRelatorioAnexado", relatorioAnexado);
  822 + result.include("totalRelatorioEnviado", relatorioEnviado);
  823 + result.include("lsquestionario", lsquestionario);
  824 + result.include("totalSolicitacoes", lsquestionario.size());
301 825 }
302 826  
303 827 }
... ...
src/br/com/controller/PlanoTrabalhoController.java
... ... @@ -389,7 +389,7 @@ public class PlanoTrabalhoController extends DefaultMultipartConfig {
389 389 Validacao validacao = new Validacao();
390 390 validacao.setCampo("valorHash");
391 391 validacao
392   - .setMensagem("ATEN��O: Voc� precisa estar logado para enviar Relat�rio � PFDC/MPF.");
  392 + .setMensagem("ATENÇÃO: Você precisa estar logado para enviar Relatório à PFDC/MPF.");
393 393  
394 394 mensagemValidacaoCampos.add(validacao);
395 395  
... ...
src/br/com/controller/QuestionarioController.java
... ... @@ -2,6 +2,8 @@ package br.com.controller;
2 2  
3 3 import java.io.IOException;
4 4 import java.security.NoSuchAlgorithmException;
  5 +import java.sql.ResultSet;
  6 +import java.sql.SQLException;
5 7 import java.text.SimpleDateFormat;
6 8 import java.util.ArrayList;
7 9 import java.util.Date;
... ... @@ -19,9 +21,11 @@ import br.com.caelum.vraptor.Validator;
19 21 import br.com.caelum.vraptor.interceptor.multipart.UploadedFile;
20 22 import br.com.caelum.vraptor.validator.ValidationMessage;
21 23 import br.com.dao.AutorizacaoGeracaoHashDao;
  24 +import br.com.dao.OrgaoDao;
22 25 import br.com.dao.QuestionarioDao;
23 26 import br.com.model.entity.Contato;
24 27 import br.com.model.entity.EnvioEmailSemAutenticacao;
  28 +import br.com.model.entity.Orgao;
25 29 import br.com.model.entity.Questionario;
26 30 import br.com.model.utilities.Email;
27 31 import br.com.model.utilities.ManagerProperties;
... ... @@ -33,280 +37,347 @@ import br.com.util.Validacao;
33 37 @Resource
34 38 public class QuestionarioController {
35 39  
36   - private Result result;
37   - private Validator validator;
38   - private ServletContext application;
39   - private String path;
40   -
41   -
42   - public QuestionarioController(Result result, Validator validator, ServletContext application) {
43   -
44   - this.result = result;
45   - this.validator = validator;
46   - this.application = application;
47   - this.path = this.application.getRealPath("") + "/WEB-INF/conexao.properties";
48   - }
49   -
50   - @Path("/questionario")
51   - public void questionario() {
52   -
53   - QuestionarioDao questionarioDao = new QuestionarioDao();
54   - List<Questionario> lsquestionario = new ArrayList<Questionario>();
55   - lsquestionario = questionarioDao.retornarListaQuestionario(path);
56   -
57   -
58   - int relatorioRespondido = 0;
59   - int planoTrabalhoAnexado = 0;
60   - int relatorioAnexado = 0;
61   - int relatorioEnviado = 0;
62   -
63   - for (Questionario questionario : lsquestionario) {
64   -
65   - if(questionario.getDataRespostaQuestionario() != null)
66   - {
67   - relatorioRespondido++;
68   - }
69   - if(questionario.isPlanoTrabalhoAnexado())
70   - {
71   - planoTrabalhoAnexado++;
72   - }
73   - if(questionario.isRelatorioAnexado())
74   - {
75   - relatorioAnexado++;
76   - }
77   - if(questionario.isFlagEnviado())
78   - {
79   - relatorioEnviado++;
80   - }
81   -
82   - }
83   -
84   - result.include("totalRelatorioRespondido", relatorioRespondido);
85   - result.include("totalPlanoTrabalhoAnexado", planoTrabalhoAnexado);
86   - result.include("totalRelatorioAnexado", relatorioAnexado);
87   - result.include("totalRelatorioEnviado", relatorioEnviado);
88   - result.include("lsquestionario", lsquestionario);
89   - result.include("totalSolicitacoes", lsquestionario.size());
90   - }
91   -
92   - @Path("/confirmacaoHash")
93   - public void confirmacaoHash() {
94   -
95   - }
96   -
97   - @Path("/lista-questionario")
98   - public void listaQuestionario() {
99   - listarQuestionarioComFiltro("todos", "todos","todos", "");
100   - }
101   -
102   - @Path("/listar-questionario")
103   - public void listarQuestionarioComFiltro(String statusRelatorio, String statusPlanoTrabalho, String relatorioAnexado, String nomeOrgao) {
104   -
105   - QuestionarioDao questionarioDao = new QuestionarioDao();
106   - List<Questionario> lsquestionario = new ArrayList<Questionario>();
107   - lsquestionario = questionarioDao.retornarListaQuestionarioComFiltro(path, statusRelatorio, statusPlanoTrabalho, relatorioAnexado, nomeOrgao);
108   - result.include("lsquestionario", lsquestionario);
109   - result.include("totalSolicitacoes", lsquestionario.size());
110   - result.include("statusRel", statusRelatorio.equalsIgnoreCase("todos")? "" :statusRelatorio);
111   - result.include("relatorioAnex", relatorioAnexado.equalsIgnoreCase("todos")? "" :relatorioAnexado);
112   - result.include("statusPlanoTrab", statusPlanoTrabalho.equalsIgnoreCase("todos")? "" :statusPlanoTrabalho);
113   - result.include("nomeOrgao", nomeOrgao != null? nomeOrgao:"");
114   -
115   - this.validator.add(new ValidationMessage("", ""));
116   - this.validator.onErrorUsePageOf(QuestionarioController.class).listaQuestionario();
117   -
118   -
119   - }
120   -
121   - @Path("/salvar-questionario")
122   - public void questionarioSalvar(String autorizacao, String noOrgao, String nomeResponsavel,
123   - String cargoResponsavel, String emailDestinoOrgao, String telefoneResponsavel, String dataRecebimentoEmail) {
124   -
125   -
126   - AutorizacaoGeracaoHashDao autorizacaoGeracaoHashDao = new AutorizacaoGeracaoHashDao();
127   - String mensagemEnvio = "";
128   - int idAutorizacaoGeracaoHash = -1;
129   -
130   - idAutorizacaoGeracaoHash = autorizacaoGeracaoHashDao.verificarAutorizacaoGeracaoHash(path, autorizacao);
131   - if (idAutorizacaoGeracaoHash > -1) {
132   - String[] codigo = emailDestinoOrgao.split("@");
133   - String codigoHash = "";
134   -
135   - codigoHash = codigo[0]
136   - + DateUtil.dataHoraAtual().toString().replace("/", "").replace(" ", "")
137   - .replace(":", "");
138   -
139   -
140   - Questionario questionario = new Questionario();
141   - // BufferedReader reader = new BufferedReader(new InputStreamReader(file.getFile()));
142   -
143   - ManagerProperties managerProperties = new ManagerProperties();
144   -
145   - String dtInicioQuestionario = "";
146   - String dtFimQuestionario = "";
147   - String hashAutenticacao = null;
148   - Properties prop = null;
149   -
150   - try {
151   - prop =
152   - managerProperties.getProp(this.application.getRealPath("")
153   - + "/WEB-INF/respostaFormulario.properties");
154   -
155   - dtInicioQuestionario = prop.getProperty("dataInicio");
156   - dtFimQuestionario = prop.getProperty("dataFim");
157   - hashAutenticacao = GeradorCodigoHash.gerarHash(codigoHash);
158   -
159   - } catch (IOException e) {
160   - e.printStackTrace();
161   - } catch (NoSuchAlgorithmException e) {
162   -
163   - e.printStackTrace();
164   - }
165   -
166   - questionario.setDtInicioQuestionario(dtInicioQuestionario);
167   - questionario.setDtFimQuestionario(dtFimQuestionario);
168   - questionario.setEmailDestinoOrgao(emailDestinoOrgao);
169   - questionario.setHashAutenticacao(hashAutenticacao);
170   - questionario.setResponsavel(nomeResponsavel);
171   - questionario.setCargoResponsavel(cargoResponsavel);
172   - questionario.setTelefone(telefoneResponsavel);
173   - questionario.setNoOrgao(noOrgao);
174   -
175   - Validacao validate = new Validacao();
176   -
177   - questionario.setDtRecebimentoEmail(dataRecebimentoEmail);
178   - questionario.setIdAutorizacaoGeracaoHash(idAutorizacaoGeracaoHash);
179   -
180   - QuestionarioDao questionarioDao = new QuestionarioDao();
181   - // List<String> corpoEmail = new ArrayList<String>();
182   -
183   - int idQuestionario = questionarioDao.salvarQuestionario(path, questionario);
184   -
185   - if (idQuestionario > -1) {
186   -
187   - StringBuffer mensagem = new StringBuffer();
188   -
189   - mensagem.append("Prezado(a),</br>");
190   - mensagem.append("<p>Senhor(a) " + nomeResponsavel + ", " + cargoResponsavel + ", do(a) "
191   - + noOrgao + ", conforme solicitado, o acesso ");
192   - mensagem.append("ao FAD para o preenchimento de informações sobre a atual situação da ");
193   - mensagem
194   - .append("acessibilidade dos ambientes digitais do seu órgão ou entidade deverá ser ");
195   - mensagem.append("realizado pelo endereço " + "<a href=\"" + prop.getProperty("enderecoFad") + "\">" + prop.getProperty("enderecoFad") + "</a>"
196   - + " utilizando o código de ");
197   - mensagem.append("acesso: " + hashAutenticacao + " .</p>");
198   -
199   - mensagem
200   - .append("<p>A guarda do código de acesso, bem como as informações prestadas são de sua ");
201   - mensagem.append("inteira responsabilidade.</p>");
202   -
203   - mensagem.append("<p>O FAD poderá ser preenchido no período "
204   - + DateUtil.dataHoraFormatadaDiaMesAno(prop.getProperty("dataInicio")) + " a 02/01/2017, data limite ");
205   - mensagem
206   - .append("para o envio do relatório circunstanciado (formulário de acessibilidade digital e plano de ");
207   - mensagem
208   - .append("trabalho) à Procuradoria Federal dos Direitos do Cidadão do Ministério Público Federal e ");
209   - mensagem.append("publicado no sítio ou portal eletrônico do órgão ou entidade.​</p>");
210   -
211   - mensagem
212   - .append("<p>Maiores informações, dúvidas e sugestões devem ser encaminhadas pelo canal ");
213   - mensagem.append("<a href=\"" + prop.getProperty("enderecoContato") + "\">" + prop.getProperty("enderecoContato") + "</a>.</p>");
214   -
215   - mensagem.append("<p>Respeitosamente,</p>");
216   -
217   - mensagem.append("<p>Ministério do Planejamento, Desenvolvimento e Gestão ");
218   - mensagem.append("Secretaria de Tecnologia da Informação ");
219   - mensagem.append("Departamento de Governo Digital ");
220   - mensagem.append("Coordenação-Geral de Padrões de Governo Digital ");
221   - mensagem.append(prop.getProperty("emailContato") + "</br>");
222   -
223   - String[] telefoneContato = prop.getProperty("telefoneContato").split(",");
224   -
225   - for (String numeroTelefone : telefoneContato) {
226   - mensagem.append(numeroTelefone + "</br>");
227   - }
228   - mensagem.append("</p>");
229   -
230   - Contato contato = new Contato();
231   - contato.setEmail(emailDestinoOrgao);
232   - contato
233   - .setAssunto("Formulário Eletrônico de Acessibilidade Digital (FAD) – Concessão de Acesso");
234   - contato.setMensagem(mensagem.toString());
235   - contato.setNome(nomeResponsavel);
236   -
237   - if (enviarHashPorEmail(contato)) {
238   - if(questionarioDao.atualizarDataRespostaQuestionario(path, idQuestionario))
239   - {
240   - mensagemEnvio = "Questionário salvo e enviado por email com suceso!";
241   - }
242   - else
243   - {
244   - mensagemEnvio = "Questionário salvo e enviado por email, mas, não foi possível atualizar a data de resposta!";
245   - }
246   -
247   - } else {
248   - mensagemEnvio = "Questionário salvo, mas não foi possível enviar email!";
249   - }
250   - result.include("mensagemEnvio", mensagemEnvio);
251   - this.validator.add(new ValidationMessage("", ""));
252   - this.validator.onErrorUsePageOf(QuestionarioController.class).confirmacaoHash();
253   - } else {
254   - mensagemEnvio = "Não foi possível salvar o questionário!";
255   - result.include("mensagemEnvio", mensagemEnvio);
256   - this.validator.add(new ValidationMessage("", ""));
257   - this.validator.onErrorUsePageOf(QuestionarioController.class).confirmacaoHash();
258   - }
259   - } else {
260   - mensagemEnvio = "É preciso autorização para gerar código Hash!";
261   - result.include("mensagemEnvio", mensagemEnvio);
262   - this.validator.add(new ValidationMessage("", ""));
263   - this.validator.onErrorUsePageOf(QuestionarioController.class).confirmacaoHash();
264   - }
265   -
266   -
267   - }
268   -
269   - private boolean enviarHashPorEmail(Contato contato) {
270   -
271   - boolean emailEnviado = false;
272   -
273   -
274   - String respSendEmail;
275   -
276   - Email email = new Email(this.application.getRealPath("") + "/WEB-INF/mail.properties");
277   -
278   - EnvioEmailSemAutenticacao envioEmailSemAutenticacao =
279   - new EnvioEmailSemAutenticacao(email.getHost(), Integer.toString(email.getPort()));
280   -
281   -
282   - respSendEmail =
283   - envioEmailSemAutenticacao.sendMailComCopia(email.getFrom(), contato.getEmail(),
284   - contato.getAssunto(), contato.getMensagem(), email.getAuth(), email.getAuthUser(),
285   - email.getAuthPass(), email.getCopiaEmailTo());
286   -
287   -
288   - /*
289   - * String respSendEmail = email.sendEmail("Contato","govbr@planejamento.gov.br",
290   - * contato.getNome(),contato.getEmail(),StringHelper.convertFromUTF8(contato.getAssunto()),
291   - * StringHelper.convertFromUTF8(contato.getMensagem()), true);
292   - */
293   -
294   - if (respSendEmail.equals("")) {
295   - result.include("mensagem", "Mensagem enviada com Sucesso");
296   - result.include("status", "success");
297   - emailEnviado = true;
298   -
299   - } else {
300   - result.include("mensagem", "Não foi possível enviar a mensagem! Ocorreu o problema: "
301   - + respSendEmail);
302   - result.include("status", "error");
303   - }
304   -
305   - return emailEnviado;
306   -
307   -
308   - }
309   -
310   -
  40 + private Result result;
  41 + private Validator validator;
  42 + private ServletContext application;
  43 + private String path;
  44 +
  45 + public QuestionarioController(Result result, Validator validator,
  46 + ServletContext application) {
  47 +
  48 + this.result = result;
  49 + this.validator = validator;
  50 + this.application = application;
  51 + this.path = this.application.getRealPath("")
  52 + + "/WEB-INF/conexao.properties";
  53 + }
  54 +
  55 + @Path("/questionario")
  56 + public void questionario() {
  57 +
  58 + QuestionarioDao questionarioDao = new QuestionarioDao();
  59 + List<Questionario> lsquestionario = new ArrayList<Questionario>();
  60 + lsquestionario = questionarioDao.retornarListaQuestionario(path);
  61 +
  62 + OrgaoDao orgaoDao = new OrgaoDao();
  63 + Orgao orgao;
  64 + List<Orgao> lsOrgao = new ArrayList<Orgao>();
  65 + ResultSet rset = null;
  66 +
  67 + rset = orgaoDao.retornarOrgaos(path);
  68 +
  69 + try {
  70 + while (rset.next()) {
  71 + orgao = new Orgao();
  72 +
  73 + orgao.setIdOrgao(rset.getInt("id_orgao"));
  74 + orgao.setNomeOrgao(rset.getString("no_orgao"));
  75 + orgao.setIdQuestionario(rset.getInt("id_questionario"));
  76 +
  77 + lsOrgao.add(orgao);
  78 + }
  79 + } catch (SQLException e) {
  80 + e.printStackTrace();
  81 + }
  82 +
  83 + int relatorioRespondido = 0;
  84 + int planoTrabalhoAnexado = 0;
  85 + int relatorioAnexado = 0;
  86 + int relatorioEnviado = 0;
  87 +
  88 + for (Questionario questionario : lsquestionario) {
  89 +
  90 + if (questionario.getDataRespostaQuestionario() != null) {
  91 + relatorioRespondido++;
  92 + }
  93 + if (questionario.isPlanoTrabalhoAnexado()) {
  94 + planoTrabalhoAnexado++;
  95 + }
  96 + if (questionario.isRelatorioAnexado()) {
  97 + relatorioAnexado++;
  98 + }
  99 + if (questionario.isFlagEnviado()) {
  100 + relatorioEnviado++;
  101 + }
  102 +
  103 + }
  104 +
  105 + result.include("lsOrgao", lsOrgao);
  106 + result.include("totalRelatorioRespondido", relatorioRespondido);
  107 + result.include("totalPlanoTrabalhoAnexado", planoTrabalhoAnexado);
  108 + result.include("totalRelatorioAnexado", relatorioAnexado);
  109 + result.include("totalRelatorioEnviado", relatorioEnviado);
  110 + result.include("lsquestionario", lsquestionario);
  111 + result.include("totalSolicitacoes", lsquestionario.size());
  112 + }
  113 +
  114 + @Path("/confirmacaoHash")
  115 + public void confirmacaoHash() {
  116 +
  117 + }
  118 +
  119 + @Path("/lista-questionario")
  120 + public void listaQuestionario() {
  121 + listarQuestionarioComFiltro("todos", "todos", "todos", "todos", "");
  122 + }
  123 +
  124 + @Path("/listar-questionario")
  125 + public void listarQuestionarioComFiltro(String statusRelatorio,
  126 + String statusPlanoTrabalho, String relatorioAnexado,
  127 + String relatorioEnviado, String nomeOrgao) {
  128 +
  129 + QuestionarioDao questionarioDao = new QuestionarioDao();
  130 + List<Questionario> lsquestionario = new ArrayList<Questionario>();
  131 + lsquestionario = questionarioDao.retornarListaQuestionarioComFiltro(
  132 + path, statusRelatorio, statusPlanoTrabalho, relatorioAnexado,
  133 + relatorioEnviado, nomeOrgao);
  134 + result.include("lsquestionario", lsquestionario);
  135 + result.include("totalSolicitacoes", lsquestionario.size());
  136 + result.include("statusRel",
  137 + statusRelatorio.equalsIgnoreCase("todos") ? ""
  138 + : statusRelatorio);
  139 + result.include("relatorioAnex", relatorioAnexado
  140 + .equalsIgnoreCase("todos") ? "" : relatorioAnexado);
  141 + result.include("statusPlanoTrab", statusPlanoTrabalho
  142 + .equalsIgnoreCase("todos") ? "" : statusPlanoTrabalho);
  143 + result.include("relatorioEnv", relatorioEnviado
  144 + .equalsIgnoreCase("todos") ? "" : relatorioEnviado);
  145 + result.include("nomeOrgao", nomeOrgao != null ? nomeOrgao : "");
  146 +
  147 + this.validator.add(new ValidationMessage("", ""));
  148 + this.validator.onErrorUsePageOf(QuestionarioController.class)
  149 + .listaQuestionario();
  150 +
  151 + }
  152 +
  153 + @Path("/salvar-questionario")
  154 + public void questionarioSalvar(String autorizacao, String idOrgao,
  155 + String nomeResponsavel, String cargoResponsavel,
  156 + String emailDestinoOrgao, String telefoneResponsavel,
  157 + String dataRecebimentoEmail) {
  158 +
  159 + AutorizacaoGeracaoHashDao autorizacaoGeracaoHashDao = new AutorizacaoGeracaoHashDao();
  160 + String mensagemEnvio = "";
  161 + int idAutorizacaoGeracaoHash = -1;
  162 +
  163 + idAutorizacaoGeracaoHash = autorizacaoGeracaoHashDao
  164 + .verificarAutorizacaoGeracaoHash(path, autorizacao);
  165 + if (idAutorizacaoGeracaoHash > -1) {
  166 + String[] codigo = emailDestinoOrgao.split("@");
  167 + String codigoHash = "";
  168 +
  169 + codigoHash = codigo[0]
  170 + + DateUtil.dataHoraAtual().toString().replace("/", "")
  171 + .replace(" ", "").replace(":", "");
  172 +
  173 + Questionario questionario = new Questionario();
  174 + // BufferedReader reader = new BufferedReader(new
  175 + // InputStreamReader(file.getFile()));
  176 +
  177 + ManagerProperties managerProperties = new ManagerProperties();
  178 +
  179 + String dtInicioQuestionario = "";
  180 + String dtFimQuestionario = "";
  181 + String hashAutenticacao = null;
  182 + Properties prop = null;
  183 +
  184 + try {
  185 + prop = managerProperties.getProp(this.application
  186 + .getRealPath("")
  187 + + "/WEB-INF/respostaFormulario.properties");
  188 +
  189 + dtInicioQuestionario = prop.getProperty("dataInicio");
  190 + dtFimQuestionario = prop.getProperty("dataFim");
  191 + hashAutenticacao = GeradorCodigoHash.gerarHash(codigoHash);
  192 +
  193 + } catch (IOException e) {
  194 + e.printStackTrace();
  195 + } catch (NoSuchAlgorithmException e) {
  196 +
  197 + e.printStackTrace();
  198 + }
  199 +
  200 + OrgaoDao orgaoDao = new OrgaoDao();
  201 + Orgao orgao = new Orgao();
  202 +
  203 + orgao = orgaoDao
  204 + .retornarOrgaoPorId(path, Integer.parseInt(idOrgao));
  205 +
  206 + if (orgao != null) {
  207 +
  208 + questionario.setDtInicioQuestionario(dtInicioQuestionario);
  209 + questionario.setDtFimQuestionario(dtFimQuestionario);
  210 + questionario.setEmailDestinoOrgao(emailDestinoOrgao);
  211 + questionario.setHashAutenticacao(hashAutenticacao);
  212 + questionario.setResponsavel(nomeResponsavel);
  213 + questionario.setCargoResponsavel(cargoResponsavel);
  214 + questionario.setTelefone(telefoneResponsavel);
  215 + questionario.setNoOrgao(orgao.getNomeOrgao());
  216 +
  217 + Validacao validate = new Validacao();
  218 +
  219 + questionario.setDtRecebimentoEmail(dataRecebimentoEmail);
  220 + questionario
  221 + .setIdAutorizacaoGeracaoHash(idAutorizacaoGeracaoHash);
  222 +
  223 + QuestionarioDao questionarioDao = new QuestionarioDao();
  224 + // List<String> corpoEmail = new ArrayList<String>();
  225 +
  226 + int idQuestionario = questionarioDao.salvarQuestionario(path,
  227 + questionario);
  228 +
  229 +
  230 + if (idQuestionario > -1) {
  231 + orgao.setIdQuestionario(idQuestionario);
  232 +
  233 + if(orgaoDao.atualizarQuestionarioOrgao(path, orgao))
  234 + {
  235 +
  236 +
  237 +
  238 + StringBuffer mensagem = new StringBuffer();
  239 +
  240 + mensagem.append("Prezado(a),</br>");
  241 + mensagem.append("<p>Senhor(a) " + nomeResponsavel + ", "
  242 + + cargoResponsavel + ", do(a) "
  243 + + orgao.getNomeOrgao()
  244 + + ", conforme solicitado, o acesso ");
  245 + mensagem.append("ao FAD para o preenchimento de informações sobre a atual situação da ");
  246 + mensagem.append("acessibilidade dos ambientes digitais do seu órgão ou entidade deverá ser ");
  247 + mensagem.append("realizado pelo endereço " + "<a href=\""
  248 + + prop.getProperty("enderecoFad") + "\">"
  249 + + prop.getProperty("enderecoFad") + "</a>"
  250 + + " utilizando o código de ");
  251 + mensagem.append("acesso: " + hashAutenticacao + " .</p>");
  252 +
  253 + mensagem.append("<p>A guarda do código de acesso, bem como as informações prestadas são de sua ");
  254 + mensagem.append("inteira responsabilidade.</p>");
  255 +
  256 + mensagem.append("<p>O FAD poderá ser preenchido no período "
  257 + + DateUtil.dataHoraFormatadaDiaMesAno(prop
  258 + .getProperty("dataInicio"))
  259 + + " a 02/01/2017, data limite ");
  260 + mensagem.append("para o envio do relatório circunstanciado (formulário de acessibilidade digital e plano de ");
  261 + mensagem.append("trabalho) à Procuradoria Federal dos Direitos do Cidadão do Ministério Público Federal e ");
  262 + mensagem.append("publicado no sítio ou portal eletrônico do órgão ou entidade.​</p>");
  263 +
  264 + mensagem.append("<p>Maiores informações, dúvidas e sugestões devem ser encaminhadas pelo canal ");
  265 + mensagem.append("<a href=\""
  266 + + prop.getProperty("enderecoContato") + "\">"
  267 + + prop.getProperty("enderecoContato") + "</a>.</p>");
  268 +
  269 + mensagem.append("<p>Respeitosamente,</p>");
  270 +
  271 + mensagem.append("<p>Ministério do Planejamento, Desenvolvimento e Gestão ");
  272 + mensagem.append("Secretaria de Tecnologia da Informação ");
  273 + mensagem.append("Departamento de Governo Digital ");
  274 + mensagem.append("Coordenação-Geral de Padrões de Governo Digital ");
  275 + mensagem.append(prop.getProperty("emailContato") + "</br>");
  276 +
  277 + String[] telefoneContato = prop.getProperty(
  278 + "telefoneContato").split(",");
  279 +
  280 + for (String numeroTelefone : telefoneContato) {
  281 + mensagem.append(numeroTelefone + "</br>");
  282 + }
  283 + mensagem.append("</p>");
  284 +
  285 + Contato contato = new Contato();
  286 + contato.setEmail(emailDestinoOrgao);
  287 + contato.setAssunto("Formulário Eletrônico de Acessibilidade Digital (FAD) – Concessão de Acesso");
  288 + contato.setMensagem(mensagem.toString());
  289 + contato.setNome(nomeResponsavel);
  290 +
  291 + if (enviarHashPorEmail(contato)) {
  292 + if (questionarioDao.atualizarDataRespostaQuestionario(
  293 + path, idQuestionario)) {
  294 + mensagemEnvio = "Questionário salvo e enviado por email com suceso!";
  295 + } else {
  296 + mensagemEnvio = "Questionário salvo e enviado por email, mas, não foi possível atualizar a data de resposta!";
  297 + }
  298 +
  299 + } else {
  300 + mensagemEnvio = "Questionário salvo, mas não foi possível enviar email!";
  301 + }
  302 + result.include("mensagemEnvio", mensagemEnvio);
  303 + this.validator.add(new ValidationMessage("", ""));
  304 + this.validator.onErrorUsePageOf(
  305 + QuestionarioController.class).confirmacaoHash();
  306 + } else {
  307 + mensagemEnvio = "Não foi possível salvar o questionário!";
  308 + result.include("mensagemEnvio", mensagemEnvio);
  309 + this.validator.add(new ValidationMessage("", ""));
  310 + this.validator.onErrorUsePageOf(
  311 + QuestionarioController.class).confirmacaoHash();
  312 + }
  313 + }
  314 + else
  315 + {
  316 + mensagemEnvio = "Não foi possível atualizar o id do questionário na tabela dos órgãos!";
  317 + result.include("mensagemEnvio", mensagemEnvio);
  318 + this.validator.add(new ValidationMessage("", ""));
  319 + this.validator.onErrorUsePageOf(
  320 + QuestionarioController.class).confirmacaoHash();
  321 + }
  322 + } else {
  323 + mensagemEnvio = "É preciso autorização para gerar código Hash!";
  324 + result.include("mensagemEnvio", mensagemEnvio);
  325 + this.validator.add(new ValidationMessage("", ""));
  326 + this.validator.onErrorUsePageOf(QuestionarioController.class)
  327 + .confirmacaoHash();
  328 + }
  329 + }
  330 + else
  331 + {
  332 + mensagemEnvio = "Não foi possível identificar o Órgao!";
  333 + result.include("mensagemEnvio", mensagemEnvio);
  334 + this.validator.add(new ValidationMessage("", ""));
  335 + this.validator.onErrorUsePageOf(QuestionarioController.class)
  336 + .confirmacaoHash();
  337 + }
  338 +
  339 + }
  340 +
  341 + private boolean enviarHashPorEmail(Contato contato) {
  342 +
  343 + boolean emailEnviado = false;
  344 +
  345 + String respSendEmail;
  346 +
  347 + Email email = new Email(this.application.getRealPath("")
  348 + + "/WEB-INF/mail.properties");
  349 +
  350 + EnvioEmailSemAutenticacao envioEmailSemAutenticacao = new EnvioEmailSemAutenticacao(
  351 + email.getHost(), Integer.toString(email.getPort()));
  352 +
  353 + respSendEmail = envioEmailSemAutenticacao.sendMailComCopia(
  354 + email.getFrom(), contato.getEmail(), contato.getAssunto(),
  355 + contato.getMensagem(), email.getAuth(), email.getAuthUser(),
  356 + email.getAuthPass(), email.getCopiaEmailTo());
  357 +
  358 + /*
  359 + * String respSendEmail =
  360 + * email.sendEmail("Contato","govbr@planejamento.gov.br",
  361 + * contato.getNome
  362 + * (),contato.getEmail(),StringHelper.convertFromUTF8(contato
  363 + * .getAssunto()), StringHelper.convertFromUTF8(contato.getMensagem()),
  364 + * true);
  365 + */
  366 +
  367 + if (respSendEmail.equals("")) {
  368 + result.include("mensagem", "Mensagem enviada com Sucesso");
  369 + result.include("status", "success");
  370 + emailEnviado = true;
  371 +
  372 + } else {
  373 + result.include("mensagem",
  374 + "Não foi possível enviar a mensagem! Ocorreu o problema: "
  375 + + respSendEmail);
  376 + result.include("status", "error");
  377 + }
  378 +
  379 + return emailEnviado;
  380 +
  381 + }
311 382  
312 383 }
... ...
src/br/com/dao/OrgaoDao.java 0 → 100644
... ... @@ -0,0 +1,122 @@
  1 +package br.com.dao;
  2 +
  3 +import java.sql.Connection;
  4 +import java.sql.PreparedStatement;
  5 +import java.sql.ResultSet;
  6 +import java.sql.SQLException;
  7 +import java.sql.Statement;
  8 +
  9 +import br.com.model.entity.Orgao;
  10 +
  11 +public class OrgaoDao {
  12 +
  13 + public ResultSet retornarOrgaos(String path) {
  14 +
  15 + StringBuffer sql = new StringBuffer();
  16 + Connection con = Conexao.conecta(path);
  17 + Statement estado;
  18 + ResultSet rset = null;
  19 +
  20 + try {
  21 + estado = con.createStatement();
  22 +
  23 + estado.execute(sql.toString());
  24 + sql.append(" SELECT id_orgao, no_orgao, id_questionario FROM public.orgao order by no_orgao; ");
  25 +
  26 + rset = estado.executeQuery(sql.toString());
  27 +
  28 + return rset;
  29 + } catch (SQLException e) {
  30 + e.printStackTrace();
  31 + return null;
  32 +
  33 + }finally {
  34 + if (con != null) {
  35 + try {
  36 + con.close();
  37 + } catch (SQLException e) {
  38 + e.printStackTrace();
  39 + }
  40 + }
  41 + }
  42 +
  43 + }
  44 +
  45 + public Orgao retornarOrgaoPorId(String path, int idOrgao) {
  46 +
  47 + StringBuffer sql = new StringBuffer();
  48 + Connection con = Conexao.conecta(path);
  49 + Statement estado;
  50 + ResultSet rset = null;
  51 + Orgao orgao = new Orgao();
  52 +
  53 + try {
  54 + estado = con.createStatement();
  55 +
  56 + estado.execute(sql.toString());
  57 + sql.append(" SELECT * FROM public.orgao where id_orgao = "+ idOrgao +" order by no_orgao; ");
  58 +
  59 + rset = estado.executeQuery(sql.toString());
  60 +
  61 + while (rset.next()) {
  62 + orgao.setIdOrgao(idOrgao);
  63 + orgao.setNomeOrgao(rset.getString("no_orgao"));
  64 + orgao.setIdQuestionario(rset.getInt("id_questionario"));
  65 +
  66 + }
  67 +
  68 + return orgao;
  69 + } catch (SQLException e) {
  70 + e.printStackTrace();
  71 + return null;
  72 +
  73 + }finally {
  74 + if (con != null) {
  75 + try {
  76 + con.close();
  77 + } catch (SQLException e) {
  78 + e.printStackTrace();
  79 + }
  80 + }
  81 + }
  82 +
  83 + }
  84 +
  85 + public boolean atualizarQuestionarioOrgao(String path, Orgao orgao)
  86 + {
  87 +
  88 + StringBuffer sql = new StringBuffer();
  89 + Connection con = Conexao.conecta(path);
  90 + PreparedStatement estado;
  91 + int resultado = 0;
  92 + boolean salvoComSucesso = false;
  93 +
  94 +
  95 +
  96 + try {
  97 +
  98 + sql = new StringBuffer();
  99 + sql.append(" UPDATE public.orgao SET id_questionario = ? WHERE id_orgao = ?; ");
  100 +
  101 + estado = con.prepareStatement(sql.toString());
  102 +
  103 + estado.setInt(1, orgao.getIdQuestionario());
  104 + estado.setInt(2, orgao.getIdOrgao());
  105 +
  106 + resultado = estado.executeUpdate();
  107 +
  108 + if (resultado == 0) {
  109 + salvoComSucesso = false;
  110 + } else {
  111 +
  112 + salvoComSucesso = true;
  113 + }
  114 +
  115 + } catch (SQLException e) {
  116 +
  117 + e.printStackTrace();
  118 + }
  119 +
  120 + return salvoComSucesso;
  121 + }
  122 +}
... ...
src/br/com/dao/PainelDao.java
... ... @@ -7,6 +7,37 @@ import java.sql.Statement;
7 7  
8 8 public class PainelDao {
9 9  
  10 +
  11 + public Integer retornarTotalQuestionarioRespondido(String path) {
  12 +
  13 + StringBuffer sql = new StringBuffer();
  14 + Connection con = Conexao.conecta(path);
  15 + Statement estado;
  16 + ResultSet rset = null;
  17 + Integer total = 0;
  18 +
  19 + try {
  20 +
  21 + estado = con.createStatement();
  22 +
  23 + estado.execute(sql.toString());
  24 +
  25 + sql.append(" select count(id_questionario) AS total from questionario where id_questionario IN (select distinct(id_questionario) as totalRespondido from resposta_questionario) ");
  26 +
  27 + rset = estado.executeQuery(sql.toString());
  28 +
  29 + while (rset.next()) {
  30 + total = rset.getInt("total");
  31 + }
  32 +
  33 + } catch (SQLException e) {
  34 +
  35 + e.printStackTrace();
  36 + }
  37 +
  38 + return total;
  39 + }
  40 +
10 41 public Integer retornarTotalResposta(String path, Integer idPergunta, Integer idOpcaoResposta) {
11 42  
12 43 StringBuffer sql = new StringBuffer();
... ... @@ -38,7 +69,7 @@ public class PainelDao {
38 69 return total;
39 70 }
40 71  
41   - public ResultSet retornarTotalNotas(String path, Integer idOpcaoResposta) {
  72 + public ResultSet retornarTotalNotas(String path, Integer idOpcaoResposta, Integer idRespostaQuestionario) {
42 73  
43 74 StringBuffer sql = new StringBuffer();
44 75 Connection con = Conexao.conecta(path);
... ... @@ -51,7 +82,7 @@ public class PainelDao {
51 82  
52 83 estado.execute(sql.toString());
53 84  
54   - sql.append(" select texto_resposta from resposta_questionario where id_opcao_resposta = "+ idOpcaoResposta +"; ");
  85 + sql.append(" select texto_resposta from resposta_questionario where id_opcao_resposta = "+ idOpcaoResposta +" and id_resposta_questionario = " + idRespostaQuestionario + "; ");
55 86  
56 87 rset = estado.executeQuery(sql.toString());
57 88  
... ...
src/br/com/dao/QuestionarioDao.java
... ... @@ -105,7 +105,7 @@ public class QuestionarioDao {
105 105 return listaQuestionario;
106 106 }
107 107  
108   - public List<Questionario> retornarListaQuestionarioComFiltro(String path, String statusRelatorio, String statusPlanoTrabalho, String relatorioAnexado, String nomeOrgao) {
  108 + public List<Questionario> retornarListaQuestionarioComFiltro(String path, String statusRelatorio, String statusPlanoTrabalho, String relatorioAnexado, String relatorioEnviado, String nomeOrgao) {
109 109  
110 110 List<Questionario> listaQuestionario = new ArrayList<Questionario>();
111 111  
... ... @@ -114,7 +114,7 @@ public class QuestionarioDao {
114 114 RespostaQuestionarioDao respostaQuestionarioDao;
115 115 PlanoTrabalhoDao planoTrabalhoDao;
116 116  
117   - rset = retornarQuestionarioComFiltro(path, statusRelatorio, statusPlanoTrabalho, nomeOrgao);
  117 + rset = retornarQuestionarioComFiltro(path, statusRelatorio, statusPlanoTrabalho, relatorioEnviado, nomeOrgao);
118 118 String dataRespostaQuestionario = "";
119 119 try {
120 120 while (rset.next()) {
... ... @@ -149,6 +149,7 @@ public class QuestionarioDao {
149 149 questionario.setDtRespostaEmail(dataRespostaQuestionario);
150 150 }
151 151  
  152 +
152 153  
153 154 questionario.setDataRespostaQuestionario(respostaQuestionarioDao.verificaRespostaQuestionario(path, rset.getInt("id_questionario")));
154 155  
... ... @@ -265,7 +266,39 @@ public class QuestionarioDao {
265 266  
266 267 }
267 268  
268   - public ResultSet retornarQuestionarioComFiltro(String path, String statusRelatorio, String statusPlanoTrabalho, String nomeOrgao) {
  269 + public ResultSet retornarQuestionarioEnviados(String path) {
  270 +
  271 + StringBuffer sql = new StringBuffer();
  272 + Connection con = Conexao.conecta(path);
  273 + Statement estado;
  274 + ResultSet rset = null;
  275 +
  276 + try {
  277 + estado = con.createStatement();
  278 +
  279 + estado.execute(sql.toString());
  280 + sql.append(" select id_questionario from questionario where flag_enviado = true order by id_questionario; ");
  281 +
  282 + rset = estado.executeQuery(sql.toString());
  283 +
  284 + return rset;
  285 + } catch (SQLException e) {
  286 + e.printStackTrace();
  287 + return null;
  288 +
  289 + } finally {
  290 + if (con != null) {
  291 + try {
  292 + con.close();
  293 + } catch (SQLException e) {
  294 + e.printStackTrace();
  295 + }
  296 + }
  297 + }
  298 +
  299 + }
  300 +
  301 + public ResultSet retornarQuestionarioComFiltro(String path, String statusRelatorio, String statusPlanoTrabalho, String relatorioEnviado, String nomeOrgao) {
269 302  
270 303 StringBuffer sql = new StringBuffer();
271 304 Connection con = Conexao.conecta(path);
... ... @@ -293,7 +326,15 @@ public class QuestionarioDao {
293 326 {
294 327 sql.append(" and questionario_respondido = false " );
295 328 }
  329 +
  330 + if(relatorioEnviado.equalsIgnoreCase("sim"))
  331 + {
  332 + sql.append(" and flag_enviado = true ");
296 333  
  334 + }else if(relatorioEnviado.equalsIgnoreCase("nao"))
  335 + {
  336 + sql.append(" and flag_enviado = false " );
  337 + }
297 338  
298 339 sql.append(" order by no_orgao;");
299 340  
... ...
src/br/com/model/entity/Orgao.java 0 → 100644
... ... @@ -0,0 +1,30 @@
  1 +package br.com.model.entity;
  2 +
  3 +public class Orgao {
  4 +
  5 +
  6 + private Integer idOrgao;
  7 + private String nomeOrgao;
  8 + private Integer idQuestionario;
  9 +
  10 + public Integer getIdOrgao() {
  11 + return idOrgao;
  12 + }
  13 + public void setIdOrgao(Integer idOrgao) {
  14 + this.idOrgao = idOrgao;
  15 + }
  16 + public String getNomeOrgao() {
  17 + return nomeOrgao;
  18 + }
  19 + public void setNomeOrgao(String nomeOrgao) {
  20 + this.nomeOrgao = nomeOrgao;
  21 + }
  22 + public Integer getIdQuestionario() {
  23 + return idQuestionario;
  24 + }
  25 + public void setIdQuestionario(Integer idQuestionario) {
  26 + this.idQuestionario = idQuestionario;
  27 + }
  28 +
  29 +
  30 +}
... ...