我的JasperReport并没有创建报告,只是一个空白页面



我正试图用Spring Boot创建一个JasperReport。我的端点返回了一些字节[],但它只是空白。。。我不知道我做错了什么。

try{            
Map<String, Object> extractParams = new HashMap<>();
Marina marina = marinaProvider.findById(marinaId);
MovementPlan movementPlan = this.getMovementPlanById(movementPlanId, marinaId);
extractParams.put("MARINA_NAME", marina.getTradeName());
extractParams.put("MARINA_CNPJ", marina.getCompanyFederalId());
extractParams.put("BOAT_NAME", movementPlan.getBoat().getName());
extractParams.put("BOAT_TYPE", movementPlan.getBoat().getBowType());
extractParams.put("BOAT_MODEL", movementPlan.getBoat().getModelYear());
extractParams.put("BOAT_TIE", movementPlan.getBoat().getTie());
extractParams.put("RESPONSABLE", movementPlan.getNavigationPlan().getResponsible().getName());
extractParams.put("CONTACT_RESPONSABLE", movementPlan.getNavigationPlan().getResponsible().getEmergencyContact());
extractParams.put("SAILOR", "Sem marinheiro");
extractParams.put("CONTACT_SAILOR", "000-0000");
extractParams.put("VACANCY", movementPlan.getBoat().getVacancy().getCode());
extractParams.put("OUTPUT_EXPECTATION", movementPlan.getCurrentMovement().getMovementPlan().getId());

extractParams.put("REPORT_LOCALE", new Locale("pt", "BR"));
InputStream inputStream = this.getClass().getResourceAsStream("/reports/movementReport/MovementPlan.jasper");
JasperPrint jasperPrint = JasperFillManager.fillReport(inputStream, extractParams);
return JasperExportManager.exportReportToPdf(jasperPrint);
}catch (JRException e) {
e.printStackTrace();
throw new MarineException("ERROR", "Relatório", "Erro ao gerar plano de movimentação");
}

这是我的jrxml:我使用DontPad是因为它的太长

刚刚发现,由于我已经带来了数据,而不是JasperSoft查询它,我需要传递并清空DataSource,所以它工作得很好:

JasperPrint jasperPrint = JasperFillManager.fillReport(inputStream, extractParams, new JREmptyDataSource());

最新更新