pembuatan cetakan sppb

This commit is contained in:
Kals1um 2024-12-11 09:24:30 +07:00
parent 3cbfa444a0
commit 1ac5776fc4
3 changed files with 26 additions and 0 deletions

View File

@ -314,4 +314,12 @@ public class ReportingController {
response.setContentType("application/pdf");
JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream());
}
@RequestMapping(value = {"/sppb/{norec}"}, method = {RequestMethod.GET})
public void exportSppb(@PathVariable("norec") String norec,
ModelAndView mv, HttpServletResponse response) throws Exception {
JasperPrint jasperPrint = this.reportingService.exportPdfSppb(norec);
response.setContentType("application/pdf");
JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream());
}
}

View File

@ -421,4 +421,18 @@ public class ReportingDao {
}
return null;
}
public JasperPrint exportPdfSppb(String norec) {
try (Connection conn = this.jdbcTemplate1.getDataSource().getConnection()) {
String path = jasperDirPath + "sppb.jrxml";
JasperReport jasperReport = JasperCompileManager.compileReport(path);
Map<String, Object> parameters = new HashMap<>();
parameters.put("norec", norec);
return JasperFillManager.fillReport(jasperReport, parameters, conn);
} catch (Exception e) {
LOG.error("Exception at exportPdfSppb");
LOG.error(ReportingDao.class, e);
}
return null;
}
}

View File

@ -127,4 +127,8 @@ public class ReportingService {
public JasperPrint exportPdfMonitoringUsulan(String norec) {
return this.reportingDao.exportPdfMonitoringUsulan(norec);
}
public JasperPrint exportPdfSppb(String norec) {
return this.reportingDao.exportPdfSppb(norec);
}
}