Update service reporting

Pembuatan endpoint API untuk cetakan kwitansi di SMART
This commit is contained in:
Salman Manoe 2024-08-15 09:42:40 +07:00
parent 19c485f717
commit 2b062bff69
3 changed files with 30 additions and 4 deletions

View File

@ -283,7 +283,7 @@ public class ReportingController {
@RequestMapping(value = {"/summary-list/{nocm}"}, method = {RequestMethod.GET})
public void exportSummaryList(@PathVariable("nocm") String nocm,
ModelAndView mv, HttpServletResponse response) throws Exception {
ModelAndView mv, HttpServletResponse response) throws Exception {
JasperPrint jasperPrint = this.reportingService.exportPdfSummaryList(nocm);
response.setContentType("application/pdf");
JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream());
@ -291,11 +291,19 @@ public class ReportingController {
@RequestMapping(value = {"/lap-amprahan-tindakan"}, method = {RequestMethod.GET})
public void exportAmprahanTindakan(@RequestParam("idRu") int idRu,
@RequestParam("tglAwal") String tglAwal,
@RequestParam("tglAkhir") String tglAkhir, ModelAndView mv,
HttpServletRequest req, HttpServletResponse response) throws Exception {
@RequestParam("tglAwal") String tglAwal,
@RequestParam("tglAkhir") String tglAkhir, ModelAndView mv,
HttpServletRequest req, HttpServletResponse response) throws Exception {
JasperPrint jasperPrint = this.reportingService.printPdfAmprahanTindakan(idRu, tglAwal, tglAkhir);
response.setContentType("application/pdf");
JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream());
}
@RequestMapping(value = {"/kwitansi/{noSbm}"}, method = {RequestMethod.GET})
public void exportKwitansi(@PathVariable("noSbm") String noSbm,
ModelAndView mv, HttpServletResponse response) throws Exception {
JasperPrint jasperPrint = this.reportingService.exportPdfKwitansi(noSbm);
response.setContentType("application/pdf");
JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream());
}
}

View File

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

View File

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