Update service reporting

Pembuatan api cetakan summary list
This commit is contained in:
Salman Manoe 2023-12-11 14:55:57 +07:00
parent 8765506b7f
commit 75abeb5471
3 changed files with 26 additions and 1 deletions

View File

@ -276,4 +276,12 @@ public class ReportingController {
response.setContentType("application/pdf"); response.setContentType("application/pdf");
JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream()); JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream());
} }
@RequestMapping(value = {"/summary-list/{nocm}"}, method = {RequestMethod.GET})
public void exportSummaryList(@PathVariable("nocm") String nocm,
ModelAndView mv, HttpServletResponse response) throws Exception {
JasperPrint jasperPrint = this.reportingService.exportPdfSummaryList(nocm);
response.setContentType("application/pdf");
JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream());
}
} }

View File

@ -57,7 +57,6 @@ public class ReportingDao {
exporter.setConfiguration(configuration); exporter.setConfiguration(configuration);
PrintService[] services = PrintServiceLookup.lookupPrintServices(null, null); PrintService[] services = PrintServiceLookup.lookupPrintServices(null, null);
PrintService selectedService = null; PrintService selectedService = null;
int var10 = services.length;
for (PrintService service : services) { for (PrintService service : services) {
String existingPrinter = service.getName(); String existingPrinter = service.getName();
if (existingPrinter.equals(selectedPrinter)) { if (existingPrinter.equals(selectedPrinter)) {
@ -362,4 +361,18 @@ public class ReportingDao {
} }
return null; return null;
} }
public JasperPrint exportPdfSummaryList(String nocm) {
try (Connection conn = this.jdbcTemplate1.getDataSource().getConnection()) {
String path = jasperDirPath + "summaryList.jrxml";
JasperReport jasperReport = JasperCompileManager.compileReport(path);
Map<String, Object> parameters = new HashMap<>();
parameters.put("nocm", nocm);
return JasperFillManager.fillReport(jasperReport, parameters, conn);
} catch (Exception e) {
LOG.error("Exception at exportPdfLabelPaket");
LOG.error(ReportingDao.class, e);
}
return null;
}
} }

View File

@ -95,4 +95,8 @@ public class ReportingService {
public JasperPrint exportPdfResumeMedis(String norec) { public JasperPrint exportPdfResumeMedis(String norec) {
return this.reportingDao.exportPdfResumeMedis(norec); return this.reportingDao.exportPdfResumeMedis(norec);
} }
public JasperPrint exportPdfSummaryList(String nocm) {
return this.reportingDao.exportPdfSummaryList(nocm);
}
} }