Rev 1705 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1574 | jmachado | 1 | package pt.estgp.estgweb.services.questionarios.pedagogico.reportprocessors; |
1569 | jmachado | 2 | |
1571 | jmachado | 3 | import jomm.dao.impl.AbstractDao; |
1586 | jmachado | 4 | import jomm.utils.FilesUtils; |
1571 | jmachado | 5 | import org.apache.log4j.Logger; |
6 | import org.hibernate.Query; |
||
7 | import pt.estgp.estgweb.domain.OlapStarFactQuestionarioAnswer; |
||
1586 | jmachado | 8 | import pt.estgp.estgweb.domain.QuestionarioReportFileAno; |
9 | import pt.estgp.estgweb.domain.QuestionarioReportFileGroupAno; |
||
10 | import pt.estgp.estgweb.domain.dao.DaoFactory; |
||
11 | import pt.estgp.estgweb.filters.chains.ResourceAccessControlEnum; |
||
1830 | jmachado | 12 | import pt.estgp.estgweb.services.data.IRepositoryFile; |
1586 | jmachado | 13 | import pt.estgp.estgweb.services.data.RepositoryService; |
1571 | jmachado | 14 | import pt.estgp.estgweb.services.questionarios.PedagogicoAlunosProcessor; |
1574 | jmachado | 15 | import pt.estgp.estgweb.services.questionarios.pedagogico.reportprocessors.queries.PerguntasGrupoQueryDao; |
16 | import pt.estgp.estgweb.services.questionarios.pedagogico.reportprocessors.queries.QueryDaoUtils; |
||
17 | import pt.estgp.estgweb.services.questionarios.pedagogico.reportprocessors.queries.QuestionariosQueryDao; |
||
1576 | jmachado | 18 | import pt.estgp.estgweb.services.questionarios.pedagogico.reportprocessors.reportdomains.EntityEvaluated; |
19 | import pt.estgp.estgweb.services.questionarios.pedagogico.reportprocessors.reportdomains.QuestionariosAlunosReport; |
||
1574 | jmachado | 20 | import pt.estgp.estgweb.services.questionarios.pedagogico.reportprocessors.utils.*; |
1571 | jmachado | 21 | import pt.estgp.estgweb.utils.ConfigProperties; |
22 | |||
23 | import java.awt.*; |
||
1586 | jmachado | 24 | import java.io.File; |
25 | import java.io.FileInputStream; |
||
26 | import java.io.FileNotFoundException; |
||
1571 | jmachado | 27 | import java.io.IOException; |
28 | import java.text.DecimalFormat; |
||
29 | import java.util.ArrayList; |
||
30 | import java.util.List; |
||
1830 | jmachado | 31 | import java.util.zip.ZipInputStream; |
1571 | jmachado | 32 | |
1569 | jmachado | 33 | /** |
34 | * Created by jorgemachado on 16/12/16. |
||
35 | */ |
||
1579 | jmachado | 36 | public abstract class ReportAlunosGenerator extends ReportGenerator |
1569 | jmachado | 37 | { |
38 | |||
1574 | jmachado | 39 | private static final 1.5.0/docs/api/java/util/logging/Logger.html">Logger logger = 1.5.0/docs/api/java/util/logging/Logger.html">Logger.getLogger(ReportAlunosGenerator.class); |
1571 | jmachado | 40 | |
1569 | jmachado | 41 | protected 1.5.0/docs/api/java/lang/String.html">String anoLectivo; |
42 | protected 1.5.0/docs/api/java/lang/String.html">String[] periodos; |
||
43 | protected 1.5.0/docs/api/java/lang/String.html">String[] degrees; |
||
44 | |||
1574 | jmachado | 45 | public ReportAlunosGenerator(1.5.0/docs/api/java/lang/String.html">String anoLectivo, 1.5.0/docs/api/java/lang/String.html">String[] periodos, 1.5.0/docs/api/java/lang/String.html">String[] degrees) { |
1569 | jmachado | 46 | this.anoLectivo = anoLectivo; |
47 | this.periodos = periodos; |
||
48 | this.degrees = degrees; |
||
49 | } |
||
1570 | jmachado | 50 | |
51 | |||
1571 | jmachado | 52 | /** |
53 | * Gera um gráfico com todas as respostas agregadas por questao para um professor |
||
54 | * @param codes |
||
55 | * @param anoLectivo |
||
56 | * @param report |
||
57 | */ |
||
1626 | jmachado | 58 | public static boolean criarGraficosRespostasAgregadas(1.5.0/docs/api/java/lang/String.html">String[] codes, |
1571 | jmachado | 59 | EntityEvaluated entityEvaluated, |
60 | 1.5.0/docs/api/java/lang/String.html">String anoLectivo, |
||
61 | QuestionariosAlunosReport report, |
||
62 | List<String> codigosCurso, |
||
63 | List<String> codigosEscola, |
||
64 | double tempoMinimo, |
||
65 | RespostasAgregadasGrupoStats.RespostasAgregadasChartTable respostasAgregadasChartTable, |
||
66 | RespostasAgregadasGrupoStats respostasAgregadasGrupo, |
||
67 | 1.5.0/docs/api/java/lang/String.html">String grupo, |
||
68 | 1.5.0/docs/api/java/lang/String.html">String subGrupo, |
||
69 | 1.5.0/docs/api/java/lang/String.html">String[] periodos, |
||
70 | 1.5.0/docs/api/java/lang/String.html">String[] degrees, |
||
71 | boolean generateChart) |
||
72 | { |
||
73 | 1.5.0/docs/api/java/lang/String.html">String periodosQuery = QueryDaoUtils.createPeriodosQuery(periodos, "quest", true); |
||
74 | 1.5.0/docs/api/java/lang/String.html">String degreesQuery = QueryDaoUtils.createDegreesQuery(degrees, "curso", true); |
||
75 | |||
76 | 1.5.0/docs/api/java/lang/String.html">String whereFragmentEntity = QuestionariosQueryDao.getWhereEntityCodesFragment(codes,entityEvaluated); |
||
77 | |||
78 | 1.5.0/docs/api/javax/management/Query.html">Query query;//*****CRIAR REPOSTAS DO GRUPO DOCENTE*****/// |
||
79 | |||
80 | |||
81 | query = AbstractDao.getCurrentSession().createQuery("" + |
||
82 | "SELECT " + |
||
83 | "avg(fc.intResposta) as media," + |
||
84 | "sum(case when fc.intResposta = 1 then 1 else 0 end) as r1," + |
||
85 | "sum(case when fc.intResposta = 2 then 1 else 0 end) as r2," + |
||
86 | "sum(case when fc.intResposta = 3 then 1 else 0 end) as r3," + |
||
87 | "sum(case when fc.intResposta = 4 then 1 else 0 end) as r4," + |
||
88 | "sum(case when fc.intResposta = 5 then 1 else 0 end) as r5," + |
||
89 | "std(fc.intResposta) as desvio," + |
||
90 | "count(fc.id) as total, " + |
||
91 | "prgp.pergunta as pergunta, " + |
||
92 | "prgp.numero as numero, " + |
||
93 | "avg(fc.tempoLevado) as tempoMedioLevado " + |
||
94 | |||
95 | "FROM " + OlapStarFactQuestionarioAnswer.class.getName() + " fc " + |
||
96 | "JOIN fc.olapPergunta prgp " + |
||
97 | "JOIN fc.olapTipologia tipo " + |
||
98 | "JOIN fc.olapQuestionario quest " + |
||
99 | "JOIN fc.olapCurso curso " + |
||
100 | "JOIN fc.olapTimeLine timeLine " + |
||
101 | |||
102 | "where " + |
||
103 | |||
104 | " quest.ano = :ano " + |
||
105 | whereFragmentEntity + |
||
106 | "and timeLine.nome = '" + PedagogicoAlunosProcessor.getHistoryDriveConstraintStatic() + "' " + |
||
107 | (tempoMinimo > 0 ? " and fc.tempoLevado > :tempoLevado " : "" ) + |
||
108 | periodosQuery + |
||
109 | degreesQuery + |
||
110 | (grupo == null ? "" : " and prgp.grupoCode = :grupoCode ") + |
||
111 | (subGrupo == null ? "" : " and prgp.subGrupoCode = :subGrupoCode ") + |
||
112 | "group by prgp.numero " + |
||
113 | "order by prgp.numero "); |
||
114 | if(grupo != null) |
||
115 | query.setString("grupoCode",grupo); |
||
116 | if(subGrupo != null) |
||
117 | query.setString("subGrupoCode",subGrupo); |
||
118 | // query.setString("codigoSiges",teacherCode); |
||
119 | query.setString("ano",anoLectivo); |
||
120 | if(tempoMinimo > 0) |
||
121 | { |
||
122 | query.setDouble("tempoLevado",tempoMinimo); |
||
123 | } |
||
124 | |||
1626 | jmachado | 125 | List<Object[]> resultsTest = query.list(); |
126 | if(resultsTest == null || resultsTest.size() == 0) |
||
127 | { |
||
128 | return false; |
||
129 | } |
||
1571 | jmachado | 130 | |
1626 | jmachado | 131 | |
1571 | jmachado | 132 | DataTable tableRespostasAgregadas = new DataTable(); |
133 | |||
134 | |||
135 | |||
136 | DataTable.Row header = tableRespostasAgregadas.addRowHeader(); |
||
137 | header.addColTextCenter("Questão"); |
||
138 | header.addColTextCenter("Resps."); |
||
1627 | jmachado | 139 | header.addColTextCenter("Resps. Esper."); |
1626 | jmachado | 140 | //header.addColTextCenter("Tempo Médio de Resposta (seg.)"); |
141 | header.addColTextCenter("% Resp."); |
||
1571 | jmachado | 142 | header.addColTextCenter("Nada Satisf. %"); |
143 | header.addColTextCenter("Pouco Satisf. %"); |
||
144 | header.addColTextCenter("Satisf. %"); |
||
145 | header.addColTextCenter("Bastante Satisf. %"); |
||
146 | header.addColTextCenter("Muito Satisf. %"); |
||
147 | header.addColTextCenter("Média"); |
||
148 | header.addColTextCenter("Desvio Padrão"); |
||
149 | |||
150 | if(entityEvaluated == EntityEvaluated.DOCENTE) |
||
151 | { |
||
152 | header.addColTextCenter("Média dos Cursos em que Lecciona"); |
||
153 | header.addColTextCenter("Diff Cursos"); |
||
154 | header.addColTextCenter("Média das Escolas em que Lecciona"); |
||
155 | header.addColTextCenter("Diff Escolas"); |
||
156 | } |
||
157 | else if(entityEvaluated == EntityEvaluated.CURSO) |
||
158 | { |
||
159 | header.addColTextCenter("Média da Escola"); |
||
160 | header.addColTextCenter("Diff Escola"); |
||
161 | } |
||
162 | else |
||
163 | { |
||
164 | throw new 1.5.0/docs/api/java/lang/RuntimeException.html">RuntimeException("Não implementado"); |
||
165 | } |
||
166 | |||
167 | |||
168 | |||
1626 | jmachado | 169 | PerguntasGrupoQueryDao.getMediasGrupo(codes, entityEvaluated, anoLectivo, report, codigosCurso, codigosEscola, grupo, subGrupo, respostasAgregadasGrupo.getMediasGrupo(), periodos, degrees); |
170 | |||
171 | |||
172 | //Um ciclo por pergunta numero |
||
1571 | jmachado | 173 | for(5+0%2Fdocs%2Fapi+Object">Object[] resultTest : resultsTest) |
174 | { |
||
175 | 1.5.0/docs/api/java/lang/Double.html">Double tempoMedioLevado = (1.5.0/docs/api/java/lang/Double.html">Double) resultTest[10]; |
||
176 | 1.5.0/docs/api/java/lang/Double.html">Double mediaDocente = (1.5.0/docs/api/java/lang/Double.html">Double) resultTest[0]; |
||
177 | 1.5.0/docs/api/java/lang/Double.html">Double desvio = (1.5.0/docs/api/java/lang/Double.html">Double) resultTest[6]; |
||
178 | 1.5.0/docs/api/java/lang/Long.html">Long total = (1.5.0/docs/api/java/lang/Long.html">Long) resultTest[7]; |
||
179 | double min = mediaDocente - (desvio*2); |
||
180 | double max = mediaDocente + (desvio*2); |
||
181 | if(max > 5) max = 5; |
||
1626 | jmachado | 182 | 1.5.0/docs/api/java/text/DecimalFormat.html">DecimalFormat df = new 1.5.0/docs/api/java/text/DecimalFormat.html">DecimalFormat("#,##0.00"); |
1571 | jmachado | 183 | |
184 | 1.5.0/docs/api/java/lang/String.html">String questao = resultTest[8].toString(); |
||
185 | 1.5.0/docs/api/java/lang/String.html">String numero = resultTest[9].toString(); |
||
186 | |||
187 | |||
188 | DataTable.Row rowUnidade = tableRespostasAgregadas.addRowNormal(); |
||
189 | rowUnidade.addColLabelCenter(questao); |
||
190 | rowUnidade.addColTextCenter(""+total); |
||
1626 | jmachado | 191 | rowUnidade.addColTextCenter("" + report.getQuestionariosReqTotal()); |
192 | //rowUnidade.addColTextCenter(df.format(tempoMedioLevado/1000.0)); |
||
193 | rowUnidade.addColPercentageCenter(ChartBuilderUtil.getPercentagemPrint0Slots(total, report.getQuestionariosReqTotal()), true); |
||
1571 | jmachado | 194 | DataTable.Row.Col colResposta1 = rowUnidade.addColTextCenter(resultTest[1].toString()); |
195 | DataTable.Row.Col colResposta2 = rowUnidade.addColTextCenter(resultTest[2].toString()); |
||
196 | DataTable.Row.Col colResposta3 = rowUnidade.addColTextCenter(resultTest[3].toString()); |
||
197 | DataTable.Row.Col colResposta4 = rowUnidade.addColTextCenter(resultTest[4].toString()); |
||
198 | DataTable.Row.Col colResposta5 = rowUnidade.addColTextCenter(resultTest[5].toString()); |
||
199 | |||
200 | 1.5.0/docs/api/java/lang/Long.html">Long respostas1 = (1.5.0/docs/api/java/lang/Long.html">Long) resultTest[1]; |
||
201 | 1.5.0/docs/api/java/lang/Long.html">Long respostas2 = (1.5.0/docs/api/java/lang/Long.html">Long) resultTest[2]; |
||
202 | 1.5.0/docs/api/java/lang/Long.html">Long respostas3 = (1.5.0/docs/api/java/lang/Long.html">Long) resultTest[3]; |
||
203 | 1.5.0/docs/api/java/lang/Long.html">Long respostas4 = (1.5.0/docs/api/java/lang/Long.html">Long) resultTest[4]; |
||
204 | 1.5.0/docs/api/java/lang/Long.html">Long respostas5 = (1.5.0/docs/api/java/lang/Long.html">Long) resultTest[5]; |
||
205 | |||
206 | if(respostas1 >= respostas2 && respostas1 >= respostas3 && respostas1 >= respostas4 && respostas1 >= respostas5) |
||
207 | { |
||
208 | colResposta1.setBackgroundColor(ChartBuilderUtil.COLOR_1_HEX); |
||
209 | }else if(respostas2 >= respostas1 && respostas2 >= respostas3 && respostas2 >= respostas4 && respostas2 >= respostas5) |
||
210 | { |
||
211 | colResposta2.setBackgroundColor(ChartBuilderUtil.COLOR_2_HEX); |
||
212 | }else if(respostas3 >= respostas1 && respostas3 >= respostas2 && respostas3 >= respostas4 && respostas3 >= respostas5) |
||
213 | { |
||
214 | colResposta3.setBackgroundColor(ChartBuilderUtil.COLOR_3_HEX); |
||
215 | }else if(respostas4 >= respostas1 && respostas4 >= respostas2 && respostas4 >= respostas3 && respostas4 >= respostas5) |
||
216 | { |
||
217 | colResposta4.setBackgroundColor(ChartBuilderUtil.COLOR_4_HEX); |
||
218 | }else if(respostas5 >= respostas1 && respostas5 >= respostas2 && respostas5 >= respostas3 && respostas5 >= respostas4) |
||
219 | { |
||
220 | colResposta5.setBackgroundColor(ChartBuilderUtil.COLOR_5_HEX); |
||
221 | } |
||
222 | |||
223 | |||
224 | |||
225 | |||
226 | |||
227 | double mediaCursos = QueryDaoUtils.getMediaCursos(codigosCurso, anoLectivo, numero, tempoMinimo, grupo,subGrupo, periodos, degrees); |
||
228 | double mediaEscolas = QueryDaoUtils.getMediaEscolas(codigosEscola, anoLectivo, numero, tempoMinimo, grupo,subGrupo, periodos, degrees); |
||
229 | |||
230 | |||
231 | |||
232 | try { |
||
233 | PerguntaStats perguntaStatsAndChart; |
||
234 | |||
235 | if(tempoMinimo <= 0 && generateChart) |
||
236 | { |
||
237 | List<String> info = new ArrayList<String>(); |
||
238 | info.add("Desvio Padrão: " + df.format(desvio)); |
||
239 | info.add("Média: " + df.format(mediaDocente)); |
||
240 | info.add("Respostas: " + total); |
||
241 | info.add("95% respostas entre: " + df.format(min) + " e " + df.format(max)); |
||
242 | perguntaStatsAndChart = ChartBuilderUtil.createChartRespostasPergunta(questao, info, |
||
243 | new int[]{ |
||
244 | ((1.5.0/docs/api/java/lang/Long.html">Long) resultTest[1]).intValue(), |
||
245 | ((1.5.0/docs/api/java/lang/Long.html">Long) resultTest[2]).intValue(), |
||
246 | ((1.5.0/docs/api/java/lang/Long.html">Long) resultTest[3]).intValue(), |
||
247 | ((1.5.0/docs/api/java/lang/Long.html">Long) resultTest[4]).intValue(), |
||
248 | ((1.5.0/docs/api/java/lang/Long.html">Long) resultTest[5]).intValue(), |
||
249 | }, "resposta" + tempoMinimo + numero, report.getQuestionariosReqRespondidos()); |
||
250 | |||
251 | } |
||
252 | else |
||
253 | perguntaStatsAndChart = new PerguntaStats(); |
||
254 | |||
255 | perguntaStatsAndChart.setPergunta(questao); |
||
256 | perguntaStatsAndChart.setNumero(numero); |
||
257 | perguntaStatsAndChart.setGrupo(grupo); |
||
258 | perguntaStatsAndChart.setSubGrupo(subGrupo); |
||
1572 | jmachado | 259 | perguntaStatsAndChart.setDesvio(df.format(desvio)); |
1571 | jmachado | 260 | perguntaStatsAndChart.setMediaCursosPrint(df.format(mediaCursos)); |
261 | perguntaStatsAndChart.setMediaEscolasPrint(df.format(mediaEscolas)); |
||
262 | perguntaStatsAndChart.setMediaCursos(mediaCursos); |
||
263 | perguntaStatsAndChart.setMediaEscolas(mediaEscolas); |
||
264 | perguntaStatsAndChart.setMediaEntidadeEmAvaliacao(mediaDocente); |
||
265 | perguntaStatsAndChart.setMediaEntidadeEmAvaliacaoPrint(df.format(mediaDocente)); |
||
266 | perguntaStatsAndChart.setPercentMediaCursos("" + ((int) ((mediaCursos / 5.0) * 100.0))); |
||
267 | perguntaStatsAndChart.setPercentMediaEscolas("" + ((int) ((mediaEscolas / 5.0) * 100.0))); |
||
268 | perguntaStatsAndChart.setPercentMediaEntidadeEmAvaliacao("" + ((int)((mediaDocente/5.0)*100.0))); |
||
269 | |||
270 | perguntaStatsAndChart.setDiffMediaCurso(mediaDocente - mediaCursos); |
||
271 | perguntaStatsAndChart.setDiffMediaEscola(mediaDocente - mediaEscolas); |
||
272 | perguntaStatsAndChart.setDiffMediaCursoPrint(df.format(mediaDocente - mediaCursos)); |
||
273 | perguntaStatsAndChart.setDiffMediaEscolaPrint(df.format(mediaDocente - mediaEscolas)); |
||
274 | |||
275 | rowUnidade.addColPercentageDefinedCenter(perguntaStatsAndChart.getMediaEntidadeEmAvaliacaoPrint(), perguntaStatsAndChart.getPercentMediaEntidadeEmAvaliacao(), true); |
||
276 | rowUnidade.addColTextCenter(df.format(desvio)); |
||
277 | if(entityEvaluated == EntityEvaluated.DOCENTE) |
||
278 | { |
||
279 | rowUnidade.addColPercentageDefinedCenter(perguntaStatsAndChart.getMediaCursosPrint(),perguntaStatsAndChart.getPercentMediaCursos(),true); |
||
280 | rowUnidade.addColNumberRight(perguntaStatsAndChart.getDiffMediaCursoPrint()).setBackgroundColor(ChartBuilderUtil.getBackgroundColorDiff(perguntaStatsAndChart.getDiffMediaCurso())); |
||
281 | } |
||
282 | else if(entityEvaluated == EntityEvaluated.CURSO) |
||
283 | { |
||
1579 | jmachado | 284 | //do nothing |
1571 | jmachado | 285 | } |
286 | else |
||
287 | { |
||
288 | throw new 1.5.0/docs/api/java/lang/RuntimeException.html">RuntimeException("Não implementado"); //para lembrar se implementar o de cima e esquecer este |
||
289 | } |
||
290 | rowUnidade.addColPercentageDefinedCenter(perguntaStatsAndChart.getMediaEscolasPrint(),perguntaStatsAndChart.getPercentMediaEscolas(),true); |
||
291 | rowUnidade.addColNumberRight(perguntaStatsAndChart.getDiffMediaEscolaPrint()).setBackgroundColor(ChartBuilderUtil.getBackgroundColorDiff(perguntaStatsAndChart.getDiffMediaEscola())); |
||
292 | |||
293 | respostasAgregadasChartTable.getRespostasAgregadasCharts().addChart(perguntaStatsAndChart); |
||
294 | respostasAgregadasChartTable.setRespostasTable(tableRespostasAgregadas); |
||
1626 | jmachado | 295 | //Adicionar o Grafico ao perguntaStats deste grupo |
1571 | jmachado | 296 | if(tempoMinimo <= 0) |
297 | { |
||
298 | //adicionada segunda vez para ficar na classe de agregação de respostas e medias |
||
299 | //legadamente ja estavam no chart mas metem-se aqui tambem pois estavam em rows e afins |
||
300 | respostasAgregadasGrupo.getPerguntasStats().add(perguntaStatsAndChart); |
||
301 | } |
||
302 | |||
303 | } catch (1.5.0/docs/api/java/io/IOException.html">IOException e) { |
||
304 | logger.error(e,e); |
||
305 | } |
||
306 | } |
||
1626 | jmachado | 307 | respostasAgregadasGrupo.setValid(true); |
308 | return true; |
||
1571 | jmachado | 309 | |
310 | } |
||
311 | |||
312 | |||
1705 | jmachado | 313 | protected 1.5.0/docs/api/java/lang/String.html">String criarChartETabelaMediaGruposPorUnidade(int width,int heightCategory,List<UnidadeStats> unidadesStats,1.5.0/docs/api/java/lang/String.html">String grupo1,1.5.0/docs/api/java/lang/String.html">String subgrupo1, 1.5.0/docs/api/java/lang/String.html">String grupo2,1.5.0/docs/api/java/lang/String.html">String subgrupo2,DataTable table,1.5.0/docs/api/java/lang/String.html">String tmpPathPrefix,1.5.0/docs/api/java/awt/Color.html">Color[] barColors,1.5.0/docs/api/java/awt/Color.html">Color[] labelsColors,boolean ommitCourses) throws 1.5.0/docs/api/java/io/IOException.html">IOException |
1571 | jmachado | 314 | { |
315 | //Se houver subgrupo usa-se a label do subgrupo |
||
316 | 1.5.0/docs/api/java/lang/String.html">String grupo1propertyIndex = subgrupo1 != null ? ConfigProperties.getProperty("questionario.group.inverse." + subgrupo1) : ConfigProperties.getProperty("questionario.group.inverse." + grupo1); |
||
317 | 1.5.0/docs/api/java/lang/String.html">String grupo1Label = ConfigProperties.getProperty("questionario.group" + grupo1propertyIndex + ".title"); |
||
318 | 1.5.0/docs/api/java/lang/String.html">String grupo2propertyIndex = subgrupo2 != null ? grupo2propertyIndex = ConfigProperties.getProperty("questionario.group.inverse." + subgrupo2) : ConfigProperties.getProperty("questionario.group.inverse." + grupo2); |
||
319 | 1.5.0/docs/api/java/lang/String.html">String grupo2Label = ConfigProperties.getProperty("questionario.group" + grupo2propertyIndex + ".title"); |
||
320 | |||
321 | if(table != null) |
||
322 | { |
||
323 | DataTable.Row headerDefinition = table.addRowHeader(); |
||
324 | headerDefinition.setInvisible(true); |
||
325 | headerDefinition.addColTextCenter("Unidade Inv").setWidth("20%"); |
||
326 | headerDefinition.addColTextCenter("Código Inv"); |
||
327 | headerDefinition.addColTextCenter("Curso Inv").setWidth("20%"); |
||
328 | headerDefinition.addColTextCenter("Código Curso Inv"); |
||
329 | headerDefinition.addColTextCenter("Respostas Inv"); |
||
330 | headerDefinition.addColTextCenter("Média Inv"); |
||
331 | headerDefinition.addColTextCenter("Desvio Inv"); |
||
332 | headerDefinition.addColTextCenter("Média Curso Inv"); |
||
333 | headerDefinition.addColTextCenter("Média Escola Inv"); |
||
334 | headerDefinition.addColTextCenter("Média Inv"); |
||
335 | headerDefinition.addColTextCenter("Desvio Inv"); |
||
336 | headerDefinition.addColTextCenter("Média Curso Inv"); |
||
337 | headerDefinition.addColTextCenter("Média Escola Inv"); |
||
338 | |||
339 | DataTable.Row header = table.addRowHeader(); |
||
340 | |||
341 | |||
342 | header.addColInvisible().setColspan(5); |
||
343 | DataTable.Row.Col colgrupo1 = header.addColTextCenter(grupo1Label); |
||
344 | DataTable.Row.Col colgrupo2 = header.addColTextCenter(grupo2Label); |
||
345 | colgrupo1.setColspan(4); |
||
346 | colgrupo2.setColspan(4); |
||
347 | |||
348 | colgrupo1.setBackgroundColor(ChartBuilderUtil.getRgbXslColor(barColors[0])); |
||
349 | colgrupo2.setBackgroundColor(ChartBuilderUtil.getRgbXslColor(barColors[1])); |
||
350 | |||
351 | DataTable.Row header2 = table.addRowHeader(); |
||
352 | header2.addColTextCenter("Unidade"); |
||
353 | header2.addColTextCenter("Código"); |
||
354 | header2.addColTextCenter("Curso"); |
||
355 | header2.addColTextCenter("Código Curso"); |
||
356 | header2.addColTextCenter("Resps"); |
||
357 | header2.addColTextCenter("Média").setBackgroundColor(colgrupo1.getBackgroundColor()); |
||
358 | header2.addColTextCenter("Desvio").setBackgroundColor(colgrupo1.getBackgroundColor()); |
||
359 | header2.addColTextCenter("Média Curso").setBackgroundColor(colgrupo1.getBackgroundColor()); |
||
360 | header2.addColTextCenter("Média Escola").setBackgroundColor(colgrupo1.getBackgroundColor()); |
||
361 | header2.addColTextCenter("Média").setBackgroundColor(colgrupo2.getBackgroundColor()); |
||
362 | header2.addColTextCenter("Desvio").setBackgroundColor(colgrupo2.getBackgroundColor()); |
||
363 | header2.addColTextCenter("Média Curso").setBackgroundColor(colgrupo2.getBackgroundColor()); |
||
364 | header2.addColTextCenter("Média Escola").setBackgroundColor(colgrupo2.getBackgroundColor()); |
||
365 | } |
||
366 | |||
367 | double valores[][] = new double[unidadesStats.size()][2]; |
||
368 | 1.5.0/docs/api/java/lang/String.html">String [] categories = new 1.5.0/docs/api/java/lang/String.html">String[unidadesStats.size()]; |
||
369 | int i = 0; |
||
370 | |||
1626 | jmachado | 371 | 1.5.0/docs/api/java/text/DecimalFormat.html">DecimalFormat df =new 1.5.0/docs/api/java/text/DecimalFormat.html">DecimalFormat("#,##0.00"); |
1705 | jmachado | 372 | int unidadeIndex = 1; |
1571 | jmachado | 373 | for(UnidadeStats unidadeStats : unidadesStats) |
374 | { |
||
375 | UnidadeStats.UnidadeStatsGrupo unidadeStatsGrupo1 = unidadeStats.findUnidadeStatsGrupo(grupo1,subgrupo1); |
||
376 | UnidadeStats.UnidadeStatsGrupo unidadeStatsGrupo2 = unidadeStats.findUnidadeStatsGrupo(grupo2,subgrupo2); |
||
377 | valores[i][0] = unidadeStatsGrupo1.getMediasGrupo().getAvaliacaoMedia(); |
||
378 | valores[i][1] = unidadeStatsGrupo2.getMediasGrupo().getAvaliacaoMedia(); |
||
1705 | jmachado | 379 | if(ommitCourses) |
380 | categories[i] = "Unidade " + i; |
||
381 | else |
||
382 | categories[i] = unidadeStats.getNomeUnidadeComCursoAbreviado(); |
||
1571 | jmachado | 383 | i++; |
384 | |||
385 | if(table != null) |
||
386 | { |
||
387 | DataTable.Row rowUnit = table.addRowNormal(); |
||
1705 | jmachado | 388 | |
1571 | jmachado | 389 | rowUnit.addColTextCenter(unidadeStats.getNomeUnidade()); |
390 | rowUnit.addColTextCenter(unidadeStats.getCodigoUnidade()); |
||
391 | rowUnit.addColTextCenter(unidadeStats.getNomeCurso()); |
||
392 | rowUnit.addColTextCenter(unidadeStats.getCodigoCurso()); |
||
1705 | jmachado | 393 | |
1571 | jmachado | 394 | rowUnit.addColNumberRight("" + unidadeStats.getRespostas()); |
395 | |||
396 | rowUnit.addColPercentageDefinedCenter(df.format(unidadeStatsGrupo1.getMediasGrupo().getAvaliacaoMedia()), unidadeStatsGrupo1.getMediasGrupo().getPercentAvaliacaoMediaForTables(), true); |
||
397 | rowUnit.addColNumberRight(df.format(unidadeStatsGrupo1.getMediasGrupo().getDesvioPadrao())); |
||
398 | rowUnit.addColPercentageDefinedCenter(df.format(unidadeStatsGrupo1.getMediasGrupo().getMediaGlobalNosCursos()), unidadeStatsGrupo1.getMediasGrupo().getPercentMediaGlobalNosCursosForTables(), true); |
||
399 | rowUnit.addColPercentageDefinedCenter(df.format(unidadeStatsGrupo1.getMediasGrupo().getMediaGlobalNasEscolas()), unidadeStatsGrupo1.getMediasGrupo().getPercentMediaGlobalNasEscolasForTables(), true); |
||
400 | |||
401 | rowUnit.addColPercentageDefinedCenter(df.format(unidadeStatsGrupo2.getMediasGrupo().getAvaliacaoMedia()), unidadeStatsGrupo2.getMediasGrupo().getPercentAvaliacaoMediaForTables(), true); |
||
402 | rowUnit.addColNumberRight(df.format(unidadeStatsGrupo2.getMediasGrupo().getDesvioPadrao())); |
||
403 | rowUnit.addColPercentageDefinedCenter(df.format(unidadeStatsGrupo2.getMediasGrupo().getMediaGlobalNosCursos()), unidadeStatsGrupo2.getMediasGrupo().getPercentMediaGlobalNosCursosForTables(), true); |
||
404 | rowUnit.addColPercentageDefinedCenter(df.format(unidadeStatsGrupo2.getMediasGrupo().getMediaGlobalNasEscolas()), unidadeStatsGrupo2.getMediasGrupo().getPercentMediaGlobalNasEscolasForTables(), true); |
||
405 | } |
||
406 | |||
407 | } |
||
408 | |||
409 | 1.5.0/docs/api/java/lang/String.html">String path = ChartBuilderUtil.createBarChartBarsCategories( |
||
410 | new 1.5.0/docs/api/java/lang/String.html">String[]{grupo1Label,grupo2Label}, |
||
411 | categories, |
||
412 | barColors, |
||
413 | labelsColors, |
||
414 | valores, |
||
415 | 0,5, tmpPathPrefix + "unidadesConjuntas",width,heightCategory); |
||
416 | return path; |
||
417 | } |
||
1586 | jmachado | 418 | |
419 | public 1.5.0/docs/api/java/lang/String.html">String generateBigDataCSV(1.5.0/docs/api/java/lang/String.html">String[] periodos,1.5.0/docs/api/java/lang/String.html">String[] degrees) |
||
420 | { |
||
421 | //ZipOutputStream() |
||
422 | //AbstractDao.getCurrentSession(). |
||
423 | return null; |
||
424 | } |
||
425 | |||
426 | public void zipFolder(QuestionarioReportFileGroupAno q, 1.5.0/docs/api/java/io/File.html">File reportGroupFolder,1.5.0/docs/api/java/lang/String.html">String desc,ResourceAccessControlEnum access) throws 1.5.0/docs/api/java/io/IOException.html">IOException |
||
427 | { |
||
428 | 1.5.0/docs/api/java/lang/String.html">String zipFilePath = reportGroupFolder.getAbsolutePath() + ".zip"; |
||
429 | FilesUtils.zipFolder(reportGroupFolder.getAbsolutePath(), zipFilePath); |
||
430 | FilesUtils.delete(reportGroupFolder.getAbsolutePath()); |
||
431 | 1.5.0/docs/api/java/io/File.html">File zipFile = new 1.5.0/docs/api/java/io/File.html">File(zipFilePath); |
||
432 | |||
433 | if(q.getRepositoryStreamZipFile() == null || q.getRepositoryStreamZipFile().trim().length() == 0) |
||
434 | { |
||
435 | 1.5.0/docs/api/java/lang/String.html">String repositoryStreamCode = new RepositoryService().storeRepositoryFile( |
||
436 | new 1.5.0/docs/api/java/io/FileInputStream.html">FileInputStream(zipFile), |
||
437 | "application/zip", |
||
438 | "zip", |
||
439 | (int)zipFile.length(), |
||
440 | zipFile.getName(), |
||
441 | desc, |
||
442 | access, |
||
1703 | jmachado | 443 | null, DaoFactory.getUserDaoImpl().load(new 1.5.0/docs/api/java/lang/Long.html">Long(1))); |
1586 | jmachado | 444 | q.setRepositoryStreamZipFile(repositoryStreamCode); |
445 | } |
||
446 | else |
||
447 | { |
||
1830 | jmachado | 448 | new RepositoryService().replaceLastRepositoryFileVersion( |
1586 | jmachado | 449 | q.getRepositoryStreamZipFile(), |
450 | new 1.5.0/docs/api/java/io/FileInputStream.html">FileInputStream(zipFile), |
||
451 | "application/zip", |
||
452 | "zip", |
||
1830 | jmachado | 453 | (int) zipFile.length(), |
1586 | jmachado | 454 | zipFile.getName(), |
455 | desc, |
||
456 | access); |
||
457 | } |
||
458 | zipFile.delete(); |
||
459 | } |
||
460 | |||
1830 | jmachado | 461 | |
462 | public void unZipFolder(QuestionarioReportFileGroupAno q, 1.5.0/docs/api/java/io/File.html">File reportGroupFolder) throws 1.5.0/docs/api/java/io/IOException.html">IOException |
||
463 | { |
||
464 | IRepositoryFile zipRepoFile = new RepositoryService().load(q.getRepositoryStreamZipFile(), null); |
||
465 | FilesUtils.uzip2Folder(reportGroupFolder.getAbsolutePath(),new 1.5.0/docs/api/java/util/zip/ZipInputStream.html">ZipInputStream(zipRepoFile.getInput())); |
||
466 | zipRepoFile.getInput().close(); |
||
467 | } |
||
468 | |||
1586 | jmachado | 469 | protected void sendPdfToRepository(QuestionarioReportFileAno reportFile, 1.5.0/docs/api/java/io/File.html">File tmpFile, 1.5.0/docs/api/java/lang/String.html">String descricao,ResourceAccessControlEnum access) throws 1.5.0/docs/api/java/io/FileNotFoundException.html">FileNotFoundException { |
470 | if(reportFile.getRepositoryStream() == null || reportFile.getRepositoryStream().trim().length() == 0) |
||
471 | { |
||
472 | 1.5.0/docs/api/java/lang/String.html">String repositoryStreamCode = new RepositoryService().storeRepositoryFile( |
||
473 | new 1.5.0/docs/api/java/io/FileInputStream.html">FileInputStream(tmpFile), |
||
474 | "application/pdf", |
||
475 | "pdf", |
||
476 | (int)tmpFile.length(), |
||
477 | tmpFile.getName(), |
||
478 | descricao, |
||
479 | access,//Este relatório de curso é publico |
||
1703 | jmachado | 480 | null, |
1586 | jmachado | 481 | DaoFactory.getUserDaoImpl().load(new 1.5.0/docs/api/java/lang/Long.html">Long(1))); |
482 | reportFile.setRepositoryStream(repositoryStreamCode); |
||
483 | } |
||
484 | else |
||
485 | { |
||
1830 | jmachado | 486 | new RepositoryService().replaceLastRepositoryFileVersion( |
1586 | jmachado | 487 | reportFile.getRepositoryStream(), |
488 | new 1.5.0/docs/api/java/io/FileInputStream.html">FileInputStream(tmpFile), |
||
489 | "application/pdf", |
||
490 | "pdf", |
||
491 | (int)tmpFile.length(), |
||
492 | tmpFile.getName(), |
||
493 | descricao, |
||
494 | access); |
||
495 | } |
||
496 | } |
||
1569 | jmachado | 497 | } |