Commit d5ff52ca33230ee08836640b03be8ad2304afe8e

Authored by magno.oliveira
1 parent 05b7ea3f
Exists in master

Relatório de Parametro de Calculo XLS

git-svn-id: https://svn.bento.ifrs.edu.br/default/ASES/e-selo@9957 c2178572-b5ca-4887-91d2-9e3a90c7d55b
Desenvolvimento/Codificacao/e-Selo/src/main/java/br/com/eselo/controller/ParametroCalculoController.java
... ... @@ -349,7 +349,7 @@ public class ParametroCalculoController {
349 349 return parametroCalculo;
350 350 }
351 351  
352   - @Get("/parametroAtivo")
  352 + @Get("/parametroAtivo.xls")
353 353 public File exportarAtivo(){
354 354 Long id = dao.getLastParametrosCalculoAtivo().getId();
355 355 return exportar(id);
... ... @@ -362,7 +362,15 @@ public class ParametroCalculoController {
362 362 ParametroCalculo parametroCalculo = this.dao.load(id);
363 363 List<Recomendacao> recomendacaoList = new RecomendacaoDAO(
364 364 dao.getSession()).listAllAtivas(parametroCalculo);
365   -
  365 + String msgAtivacao="";
  366 +
  367 + if(parametroCalculo.getTsInicio() != null){
  368 + msgAtivacao = "Ativado em: "+parametroCalculo.getTsInicio()+".";
  369 + }
  370 + if(parametroCalculo.getTsFim() != null){
  371 + msgAtivacao = msgAtivacao +" Encerrado em: "+parametroCalculo.getTsFim();
  372 + }
  373 +
366 374 Workbook wb = new HSSFWorkbook();
367 375 FileOutputStream fileOut;
368 376  
... ... @@ -375,10 +383,19 @@ public class ParametroCalculoController {
375 383 short rows = 0;
376 384 Row row = sheet.createRow(rows);
377 385 Cell cell = row.createCell(0);
378   - cell.setCellValue(createHelper.createRichTextString(parametroCalculo
379   - .getDescricao()));
  386 + cell.setCellValue(createHelper.createRichTextString(parametroCalculo.getDescricao()));
380 387 cell.setCellStyle(styles.get("title"));
381 388 sheet.addMergedRegion(CellRangeAddress.valueOf("$A$1:$L$1"));
  389 + rows++;
  390 +
  391 + row = sheet.createRow(rows);
  392 + cell = row.createCell(0);
  393 + cell.setCellValue(createHelper.createRichTextString(msgAtivacao));
  394 + CellStyle style = wb.createCellStyle();
  395 + style.setAlignment(CellStyle.ALIGN_CENTER);
  396 + cell.setCellStyle(style);
  397 +
  398 + sheet.addMergedRegion(CellRangeAddress.valueOf("$A$2:$L$2"));
382 399 rows += 3;
383 400  
384 401 for (Recomendacao recomendacao : recomendacaoList) {
... ... @@ -386,11 +403,15 @@ public class ParametroCalculoController {
386 403 cell = row.createCell(0);
387 404 cell.setCellValue(
388 405 createHelper.createRichTextString("Recomendação "
389   - + recomendacao.getNumeroRecomendacao()));
  406 + + recomendacao.getNumeroRecomendacao())
  407 + + ": " + recomendacao.getDescricao()
  408 + + " (Peso: "+recomendacao.getPeso()+")"
  409 + );
390 410 cell.setCellStyle(styles.get("subtitle"));
391 411 rows++;
392 412 sheet.addMergedRegion(CellRangeAddress.valueOf("$A$"+rows+":$L$"+rows));
393 413  
  414 + /*
394 415 row = sheet.createRow(rows);
395 416 cell = row.createCell(1);
396 417 cell.setCellValue("Descrição");
... ... @@ -406,16 +427,17 @@ public class ParametroCalculoController {
406 427 cell.setCellValue(recomendacao.getPeso());
407 428 cell.setCellStyle(styles.get("numeric"));
408 429 rows += 2;
  430 + */
409 431  
410 432 row = sheet.createRow(rows);
411 433 cell = row.createCell(1);
412   - cell.setCellValue("Código");
  434 + cell.setCellValue("Número Critério");
413 435 cell.setCellStyle(styles.get("label"));
414 436 cell = row.createCell(2);
415 437 cell.setCellValue("Peso");
416 438 cell.setCellStyle(styles.get("label"));
417 439 cell = row.createCell(3);
418   - cell.setCellValue("Critério");
  440 + cell.setCellValue("Descrição");
419 441 cell.setCellStyle(styles.get("label"));
420 442 rows++;
421 443  
... ... @@ -425,35 +447,40 @@ public class ParametroCalculoController {
425 447 row.createCell(2).setCellValue(criterio.getPeso());
426 448 row.createCell(3).setCellValue(criterio.getDescricao());
427 449  
  450 +
428 451 if(criterio.getTipoTeste().getId().intValue()==3){
429 452 rows++;
430 453 row = sheet.createRow(rows);
431   - cell = row.createCell(1);
  454 + cell = row.createCell(2);
432 455 cell.setCellValue("Faixa");
433 456 cell.setCellStyle(styles.get("label"));
434   - cell = row.createCell(2);
  457 + cell = row.createCell(3);
435 458 cell.setCellValue("Descrição");
436 459 cell.setCellStyle(styles.get("label"));
437   - cell = row.createCell(3);
  460 + cell = row.createCell(4);
438 461 cell.setCellValue("Início");
439 462 cell.setCellStyle(styles.get("label"));
440   - cell = row.createCell(4);
  463 + cell = row.createCell(5);
441 464 cell.setCellValue("Fim");
442 465 cell.setCellStyle(styles.get("label"));
443   - cell = row.createCell(5);
  466 + cell = row.createCell(6);
444 467 cell.setCellValue("%");
445 468 cell.setCellStyle(styles.get("label"));
  469 + rows++;
446 470  
447 471 for(Faixa faixa:criterio.getFaixas()){
448 472 row = sheet.createRow(rows);
449   - row.createCell(1).setCellValue(faixa.getFaixa());
450   - row.createCell(2).setCellValue(faixa.getDescricao());
451   - row.createCell(3).setCellValue(faixa.getFaixaInicio());
452   - row.createCell(4).setCellValue(faixa.getFaixaFim());
453   - row.createCell(5).setCellValue(faixa.getPercentualConformidade());
  473 + row.createCell(2).setCellValue(faixa.getFaixa());
  474 + row.createCell(3).setCellValue(faixa.getDescricao());
  475 + row.createCell(4).setCellValue(faixa.getFaixaInicio());
  476 + row.createCell(5).setCellValue(faixa.getFaixaFim());
  477 + row.createCell(6).setCellValue(faixa.getPercentualConformidade());
  478 + rows++;
454 479  
455 480 }
  481 +
456 482 }
  483 +
457 484  
458 485 rows++;
459 486 }
... ...
Desenvolvimento/Codificacao/e-Selo/target/classes/br/com/eselo/controller/ParametroCalculoController.class
No preview for this file type