From 26d83b12a7c52bc8161097a9cd8d6e75c2f461e9 Mon Sep 17 00:00:00 2001 From: ridwan Date: Tue, 21 Jul 2026 15:11:42 +0700 Subject: [PATCH] update smpk, surat pengantar jenazah --- .../controller/ReportingController.java | 34 +++++++++---------- .../java/com/reporting/dao/ReportingDao.java | 30 ++++++++-------- .../reporting/service/ReportingService.java | 8 ++--- 3 files changed, 36 insertions(+), 36 deletions(-) diff --git a/src/main/java/com/reporting/controller/ReportingController.java b/src/main/java/com/reporting/controller/ReportingController.java index fc5ab5f..fd08f29 100644 --- a/src/main/java/com/reporting/controller/ReportingController.java +++ b/src/main/java/com/reporting/controller/ReportingController.java @@ -1816,19 +1816,19 @@ public class ReportingController { } } -// @RequestMapping(value = {"/smpktes/{smpk}"}, method = {RequestMethod.GET}) -// public void exportPdfSMPKtes(@PathVariable("smpk") Integer smpk, -// @RequestParam(value = "printBy", required = false, defaultValue = "") String printBy, -// ModelAndView mv, HttpServletResponse response) throws Exception { -// JasperPrint jasperPrint = null; -// try { -// jasperPrint = this.reportingService.exportPdfSMPKtes(smpk, printBy); -// response.setContentType("application/pdf"); -// JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream()); -// } finally { -// jasperPrint = null; -// } -// } + @RequestMapping(value = {"/smpktes/{smpk}"}, method = {RequestMethod.GET}) + public void exportPdfSMPKtes(@PathVariable("smpk") Integer smpk, + @RequestParam(value = "printBy", required = false, defaultValue = "") String printBy, + ModelAndView mv, HttpServletResponse response) throws Exception { + JasperPrint jasperPrint = null; + try { + jasperPrint = this.reportingService.exportPdfSMPKtes(smpk, printBy); + response.setContentType("application/pdf"); + JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream()); + } finally { + jasperPrint = null; + } + } @RequestMapping(value = {"/rekap-logbook"}, method = {RequestMethod.GET}) public void handleRekapLogbook( @@ -2776,9 +2776,9 @@ public class ReportingController { } } - @RequestMapping(value = {"/surat-pengiriman-jenazah"}, method = {RequestMethod.GET}) + @RequestMapping(value = {"/surat-pengiriman-jenazah/{smpk}"}, method = {RequestMethod.GET}) public void handleSuratPengirimanJenazah( - @RequestParam("smpk") Integer smpk, + @PathVariable("smpk") Integer smpk, @RequestParam(value = "format", required = false, defaultValue = "pdf") String format, @RequestParam(value = "mode", required = false, defaultValue = "download") String mode, @RequestParam(value = "printBy", required = false, defaultValue = "") String printBy, @@ -2792,7 +2792,7 @@ public class ReportingController { if ("excel".equalsIgnoreCase(format)) { // Handle Excel export response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); - response.setHeader("Content-Disposition", "attachment; filename=Laporan_Log_Radiologi.xlsx"); + response.setHeader("Content-Disposition", "attachment; filename=Surat Pengiriman Jenazah.xlsx"); JRXlsxExporter exporter = new JRXlsxExporter(); exporter.setExporterInput(new SimpleExporterInput(jasperPrint)); @@ -2809,7 +2809,7 @@ public class ReportingController { } else { // Handle PDF preview response.setContentType("application/pdf"); - response.setHeader("Content-Disposition", "inline; filename=Laporan_Log_Radiologi.pdf"); + response.setHeader("Content-Disposition", "inline; filename=Surat Pengiriman Jenazah.pdf"); JRPdfExporter exporter = new JRPdfExporter(); exporter.setExporterInput(new SimpleExporterInput(jasperPrint)); diff --git a/src/main/java/com/reporting/dao/ReportingDao.java b/src/main/java/com/reporting/dao/ReportingDao.java index b419b82..a80b546 100644 --- a/src/main/java/com/reporting/dao/ReportingDao.java +++ b/src/main/java/com/reporting/dao/ReportingDao.java @@ -1452,20 +1452,20 @@ public class ReportingDao { return null; } -// public JasperPrint exportPdfSMPKtes(Integer smpk, String printBy) { -// try (Connection conn = this.jdbcTemplate4.getDataSource().getConnection()) { -// String path = jaspersim2DirPath + "SMPK_testing.jrxml"; -// JasperReport jasperReport = JasperCompileManager.compileReport(path); -// Map parameters = new HashMap<>(); -// parameters.put("smpk", smpk); -// parameters.put("printBy", printBy); -// return JasperFillManager.fillReport(jasperReport, parameters, conn); -// } catch (Exception var15) { -// LOG.error("Exception at exportPdfSMPKtes"); -// LOG.error(ReportingDao.class, var15); -// } -// return null; -// } + public JasperPrint exportPdfSMPKtes(Integer smpk, String printBy) { + try (Connection conn = this.jdbcTemplate4.getDataSource().getConnection()) { + String path = jaspersim2DirPath + "SMPK_testing.jrxml"; + JasperReport jasperReport = JasperCompileManager.compileReport(path); + Map parameters = new HashMap<>(); + parameters.put("smpk", smpk); + parameters.put("printBy", printBy); + return JasperFillManager.fillReport(jasperReport, parameters, conn); + } catch (Exception var15) { + LOG.error("Exception at exportPdfSMPKtes"); + LOG.error(ReportingDao.class, var15); + } + return null; + } public JasperPrint exportPdfRekapLogbook(String tahun, String bulan, Integer ksm_id, Integer pegawai_id , String printBy) { try (Connection conn = this.jdbcTemplate1.getDataSource().getConnection()) { @@ -1813,7 +1813,7 @@ public class ReportingDao { } public JasperPrint exporSuratPengirimanJenazah(Integer smpk, String printBy) { - try (Connection conn = this.jdbcTemplate4.getDataSource().getConnection()) { + try (Connection conn = this.jdbcTemplate1.getDataSource().getConnection()) { String path = jasperDirPath + "Surat_pengantar_jenazah.jrxml"; JasperReport jasperReport = JasperCompileManager.compileReport(path); Map parameters = new HashMap<>(); diff --git a/src/main/java/com/reporting/service/ReportingService.java b/src/main/java/com/reporting/service/ReportingService.java index 1980923..8fd32ca 100644 --- a/src/main/java/com/reporting/service/ReportingService.java +++ b/src/main/java/com/reporting/service/ReportingService.java @@ -479,10 +479,10 @@ public class ReportingService { return this.reportingDao.exportPdfSMPK(smpk, printBy); } -// public JasperPrint exportPdfSMPKtes(Integer smpk, String printBy) { -// log.info("Starting exportPdfSMPK with smpk: {}, printBy: {}", smpk, printBy); -// return this.reportingDao.exportPdfSMPKtes(smpk, printBy); -// } + public JasperPrint exportPdfSMPKtes(Integer smpk, String printBy) { + log.info("Starting exportPdfSMPK with smpk: {}, printBy: {}", smpk, printBy); + return this.reportingDao.exportPdfSMPKtes(smpk, printBy); + } public JasperPrint exportPdfRekapLogbook(String tahun, String bulan, Integer ksm_id, Integer pegawai_id, String printBy) { log.info("Starting exportPdfRekapLogbook with tahun: {}, bulan: {}, ksm_id: {}, pegawai_id: {}, printBy: {}", tahun, bulan, ksm_id, pegawai_id, printBy);