Update service reporting

Pemasangan API cetakan monitoring usulan barang
This commit is contained in:
Salman Manoe 2024-10-22 14:16:10 +07:00
parent 2b062bff69
commit 3cbfa444a0
4 changed files with 27 additions and 1 deletions

View File

@ -77,7 +77,7 @@
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<version>6.4.0</version>
<version>6.11.0</version>
<exclusions>
<exclusion>
<groupId>com.lowagie</groupId>

View File

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

View File

@ -407,4 +407,18 @@ public class ReportingDao {
}
return null;
}
public JasperPrint exportPdfMonitoringUsulan(String norec) {
try (Connection conn = this.jdbcTemplate1.getDataSource().getConnection()) {
String path = jasperDirPath + "monitoring_usulan.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 exportPdfMonitoringUsulan");
LOG.error(ReportingDao.class, e);
}
return null;
}
}

View File

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