update BuktiPengeluaranBarang

This commit is contained in:
ridwan 2025-12-02 15:42:30 +07:00
parent c8d1d80555
commit d4d9ef1ce8

View File

@ -22,6 +22,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.File; import java.io.File;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStream;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.NoSuchFileException; import java.nio.file.NoSuchFileException;
import java.sql.Timestamp; import java.sql.Timestamp;
@ -66,7 +67,13 @@ public class ReportingController {
try { try {
jasperPrint = this.reportingService.exportPdfLabelGizi(noregistrasi, jnsdiet); jasperPrint = this.reportingService.exportPdfLabelGizi(noregistrasi, jnsdiet);
response.setContentType("application/pdf"); response.setContentType("application/pdf");
JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream()); // Gunakan try-with-resources untuk memastikan OutputStream ditutup otomatis, mencegah kebocoran memori
try (OutputStream outputStream = response.getOutputStream()) {
// Ekspor PDF ke stream
JasperExportManager.exportReportToPdfStream(jasperPrint, outputStream);
// Panggil garbage collection secara eksplisit setelah pemrosesan untuk membantu mengelola memori (khususnya saat memproses gambar besar)
System.gc();
}
} finally { } finally {
jasperPrint = null; // Membebaskan memori setelah penggunaan jasperPrint = null; // Membebaskan memori setelah penggunaan
} }
@ -81,7 +88,13 @@ public class ReportingController {
try { try {
jasperPrint = this.reportingService.exportPdfPermintaanMakanan(idRu, tglAwal, tglAkhir); jasperPrint = this.reportingService.exportPdfPermintaanMakanan(idRu, tglAwal, tglAkhir);
response.setContentType("application/pdf"); response.setContentType("application/pdf");
JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream()); // Gunakan try-with-resources untuk memastikan OutputStream ditutup otomatis, mencegah kebocoran memori
try (OutputStream outputStream = response.getOutputStream()) {
// Ekspor PDF ke stream
JasperExportManager.exportReportToPdfStream(jasperPrint, outputStream);
// Panggil garbage collection secara eksplisit setelah pemrosesan untuk membantu mengelola memori (khususnya saat memproses gambar besar)
System.gc();
}
} finally { } finally {
jasperPrint = null; jasperPrint = null;
} }
@ -96,8 +109,14 @@ public class ReportingController {
try { try {
jasperPrint = this.reportingService.exportPdfRekapMakanan(idRu, tglAwal, tglAkhir); jasperPrint = this.reportingService.exportPdfRekapMakanan(idRu, tglAwal, tglAkhir);
response.setContentType("application/pdf"); response.setContentType("application/pdf");
JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream()); // Gunakan try-with-resources untuk memastikan OutputStream ditutup otomatis, mencegah kebocoran memori
}finally { try (OutputStream outputStream = response.getOutputStream()) {
// Ekspor PDF ke stream
JasperExportManager.exportReportToPdfStream(jasperPrint, outputStream);
// Panggil garbage collection secara eksplisit setelah pemrosesan untuk membantu mengelola memori (khususnya saat memproses gambar besar)
System.gc();
}
} finally {
jasperPrint = null; jasperPrint = null;
} }
} }
@ -109,8 +128,14 @@ public class ReportingController {
try { try {
jasperPrint = this.reportingService.printReportKartuPasien(nocm); jasperPrint = this.reportingService.printReportKartuPasien(nocm);
response.setContentType("application/pdf"); response.setContentType("application/pdf");
JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream()); // Gunakan try-with-resources untuk memastikan OutputStream ditutup otomatis, mencegah kebocoran memori
}finally { try (OutputStream outputStream = response.getOutputStream()) {
// Ekspor PDF ke stream
JasperExportManager.exportReportToPdfStream(jasperPrint, outputStream);
// Panggil garbage collection secara eksplisit setelah pemrosesan untuk membantu mengelola memori (khususnya saat memproses gambar besar)
System.gc();
}
} finally {
jasperPrint = null; jasperPrint = null;
} }
} }
@ -134,8 +159,14 @@ public class ReportingController {
try { try {
jasperPrint = this.resepService.exportPdfResepPasien(strukOrder); jasperPrint = this.resepService.exportPdfResepPasien(strukOrder);
response.setContentType("application/pdf"); response.setContentType("application/pdf");
JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream()); // Gunakan try-with-resources untuk memastikan OutputStream ditutup otomatis, mencegah kebocoran memori
}finally { try (OutputStream outputStream = response.getOutputStream()) {
// Ekspor PDF ke stream
JasperExportManager.exportReportToPdfStream(jasperPrint, outputStream);
// Panggil garbage collection secara eksplisit setelah pemrosesan untuk membantu mengelola memori (khususnya saat memproses gambar besar)
System.gc();
}
} finally {
jasperPrint = null; jasperPrint = null;
} }
} }
@ -147,8 +178,14 @@ public class ReportingController {
try { try {
jasperPrint = this.reportingService.printReportLapBedah(noregis); jasperPrint = this.reportingService.printReportLapBedah(noregis);
response.setContentType("application/pdf"); response.setContentType("application/pdf");
JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream()); // Gunakan try-with-resources untuk memastikan OutputStream ditutup otomatis, mencegah kebocoran memori
}finally { try (OutputStream outputStream = response.getOutputStream()) {
// Ekspor PDF ke stream
JasperExportManager.exportReportToPdfStream(jasperPrint, outputStream);
// Panggil garbage collection secara eksplisit setelah pemrosesan untuk membantu mengelola memori (khususnya saat memproses gambar besar)
System.gc();
}
} finally {
jasperPrint = null; jasperPrint = null;
} }
} }
@ -160,8 +197,14 @@ public class ReportingController {
try { try {
jasperPrint = this.reportingService.printReportKonsul(noorder); jasperPrint = this.reportingService.printReportKonsul(noorder);
response.setContentType("application/pdf"); response.setContentType("application/pdf");
JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream()); // Gunakan try-with-resources untuk memastikan OutputStream ditutup otomatis, mencegah kebocoran memori
}finally { try (OutputStream outputStream = response.getOutputStream()) {
// Ekspor PDF ke stream
JasperExportManager.exportReportToPdfStream(jasperPrint, outputStream);
// Panggil garbage collection secara eksplisit setelah pemrosesan untuk membantu mengelola memori (khususnya saat memproses gambar besar)
System.gc();
}
} finally {
jasperPrint = null; jasperPrint = null;
} }
} }
@ -201,8 +244,14 @@ public class ReportingController {
try { try {
jasperPrint = this.reportingService.printReportUpk(nores); jasperPrint = this.reportingService.printReportUpk(nores);
response.setContentType("application/pdf"); response.setContentType("application/pdf");
JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream()); // Gunakan try-with-resources untuk memastikan OutputStream ditutup otomatis, mencegah kebocoran memori
}finally { try (OutputStream outputStream = response.getOutputStream()) {
// Ekspor PDF ke stream
JasperExportManager.exportReportToPdfStream(jasperPrint, outputStream);
// Panggil garbage collection secara eksplisit setelah pemrosesan untuk membantu mengelola memori (khususnya saat memproses gambar besar)
System.gc();
}
} finally {
jasperPrint = null; jasperPrint = null;
} }
} }
@ -215,8 +264,14 @@ public class ReportingController {
try { try {
jasperPrint = this.verifikasiTagihanSupplierServices.generateVerifikasiTagihanPdf(noverifikasifk); jasperPrint = this.verifikasiTagihanSupplierServices.generateVerifikasiTagihanPdf(noverifikasifk);
response.setContentType("application/pdf"); response.setContentType("application/pdf");
JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream()); // Gunakan try-with-resources untuk memastikan OutputStream ditutup otomatis, mencegah kebocoran memori
}finally { try (OutputStream outputStream = response.getOutputStream()) {
// Ekspor PDF ke stream
JasperExportManager.exportReportToPdfStream(jasperPrint, outputStream);
// Panggil garbage collection secara eksplisit setelah pemrosesan untuk membantu mengelola memori (khususnya saat memproses gambar besar)
System.gc();
}
} finally {
jasperPrint = null; jasperPrint = null;
} }
} }
@ -230,8 +285,14 @@ public class ReportingController {
jasperPrint = this.verifikasiTagihanSupplierServices jasperPrint = this.verifikasiTagihanSupplierServices
.generateVerifikasiPembayaranUmumPdf(noverifikasifk); .generateVerifikasiPembayaranUmumPdf(noverifikasifk);
response.setContentType("application/pdf"); response.setContentType("application/pdf");
JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream()); // Gunakan try-with-resources untuk memastikan OutputStream ditutup otomatis, mencegah kebocoran memori
}finally { try (OutputStream outputStream = response.getOutputStream()) {
// Ekspor PDF ke stream
JasperExportManager.exportReportToPdfStream(jasperPrint, outputStream);
// Panggil garbage collection secara eksplisit setelah pemrosesan untuk membantu mengelola memori (khususnya saat memproses gambar besar)
System.gc();
}
} finally {
jasperPrint = null; jasperPrint = null;
} }
} }
@ -245,8 +306,14 @@ public class ReportingController {
try { try {
jasperPrint = this.reportingService.printPdfLapRekapHarianByDept(deptId, tglAwal, tglAkhir); jasperPrint = this.reportingService.printPdfLapRekapHarianByDept(deptId, tglAwal, tglAkhir);
response.setContentType("application/pdf"); response.setContentType("application/pdf");
JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream()); // Gunakan try-with-resources untuk memastikan OutputStream ditutup otomatis, mencegah kebocoran memori
}finally { try (OutputStream outputStream = response.getOutputStream()) {
// Ekspor PDF ke stream
JasperExportManager.exportReportToPdfStream(jasperPrint, outputStream);
// Panggil garbage collection secara eksplisit setelah pemrosesan untuk membantu mengelola memori (khususnya saat memproses gambar besar)
System.gc();
}
} finally {
jasperPrint = null; jasperPrint = null;
} }
} }
@ -263,8 +330,14 @@ public class ReportingController {
jasperPrint = this.reportingService jasperPrint = this.reportingService
.printPdfLapRekapHarianByRuanganId(deptId, ruangId, tglAwal, tglAkhir); .printPdfLapRekapHarianByRuanganId(deptId, ruangId, tglAwal, tglAkhir);
response.setContentType("application/pdf"); response.setContentType("application/pdf");
JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream()); // Gunakan try-with-resources untuk memastikan OutputStream ditutup otomatis, mencegah kebocoran memori
}finally { try (OutputStream outputStream = response.getOutputStream()) {
// Ekspor PDF ke stream
JasperExportManager.exportReportToPdfStream(jasperPrint, outputStream);
// Panggil garbage collection secara eksplisit setelah pemrosesan untuk membantu mengelola memori (khususnya saat memproses gambar besar)
System.gc();
}
} finally {
jasperPrint = null; jasperPrint = null;
} }
} }
@ -276,8 +349,14 @@ public class ReportingController {
try { try {
jasperPrint = this.reportingService.printPdfPengkajianAwalByNoRes(nores); jasperPrint = this.reportingService.printPdfPengkajianAwalByNoRes(nores);
response.setContentType("application/pdf"); response.setContentType("application/pdf");
JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream()); // Gunakan try-with-resources untuk memastikan OutputStream ditutup otomatis, mencegah kebocoran memori
}finally { try (OutputStream outputStream = response.getOutputStream()) {
// Ekspor PDF ke stream
JasperExportManager.exportReportToPdfStream(jasperPrint, outputStream);
// Panggil garbage collection secara eksplisit setelah pemrosesan untuk membantu mengelola memori (khususnya saat memproses gambar besar)
System.gc();
}
} finally {
jasperPrint = null; jasperPrint = null;
} }
} }
@ -293,8 +372,14 @@ public class ReportingController {
jasperPrint = this.reportingService jasperPrint = this.reportingService
.printPdfRekapPenjamin(tglAwal, tglAkhir, idDept, kelompokPasien); .printPdfRekapPenjamin(tglAwal, tglAkhir, idDept, kelompokPasien);
response.setContentType("application/pdf"); response.setContentType("application/pdf");
JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream()); // Gunakan try-with-resources untuk memastikan OutputStream ditutup otomatis, mencegah kebocoran memori
}finally { try (OutputStream outputStream = response.getOutputStream()) {
// Ekspor PDF ke stream
JasperExportManager.exportReportToPdfStream(jasperPrint, outputStream);
// Panggil garbage collection secara eksplisit setelah pemrosesan untuk membantu mengelola memori (khususnya saat memproses gambar besar)
System.gc();
}
} finally {
jasperPrint = null; jasperPrint = null;
} }
} }
@ -310,8 +395,14 @@ public class ReportingController {
jasperPrint = this.reportingService jasperPrint = this.reportingService
.printPdfRekapPenjaminByInstitusiPasien(tglAwal, tglAkhir, idDept, kelompokPasien, institusiPasien); .printPdfRekapPenjaminByInstitusiPasien(tglAwal, tglAkhir, idDept, kelompokPasien, institusiPasien);
response.setContentType("application/pdf"); response.setContentType("application/pdf");
JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream()); // Gunakan try-with-resources untuk memastikan OutputStream ditutup otomatis, mencegah kebocoran memori
}finally { try (OutputStream outputStream = response.getOutputStream()) {
// Ekspor PDF ke stream
JasperExportManager.exportReportToPdfStream(jasperPrint, outputStream);
// Panggil garbage collection secara eksplisit setelah pemrosesan untuk membantu mengelola memori (khususnya saat memproses gambar besar)
System.gc();
}
} finally {
jasperPrint = null; jasperPrint = null;
} }
} }
@ -327,8 +418,14 @@ public class ReportingController {
jasperPrint = this.reportingService jasperPrint = this.reportingService
.printPdfRekapPenjaminByRanap(tglAwal, tglAkhir, idDept, kelompokPasien); .printPdfRekapPenjaminByRanap(tglAwal, tglAkhir, idDept, kelompokPasien);
response.setContentType("application/pdf"); response.setContentType("application/pdf");
JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream()); // Gunakan try-with-resources untuk memastikan OutputStream ditutup otomatis, mencegah kebocoran memori
}finally { try (OutputStream outputStream = response.getOutputStream()) {
// Ekspor PDF ke stream
JasperExportManager.exportReportToPdfStream(jasperPrint, outputStream);
// Panggil garbage collection secara eksplisit setelah pemrosesan untuk membantu mengelola memori (khususnya saat memproses gambar besar)
System.gc();
}
} finally {
jasperPrint = null; jasperPrint = null;
} }
} }
@ -344,8 +441,14 @@ public class ReportingController {
try { try {
jasperPrint = this.reportingService.printPdfPermintaanMakanan(idRu, tglAwal, tglAkhir, jenisDiet, tglLayanan); jasperPrint = this.reportingService.printPdfPermintaanMakanan(idRu, tglAwal, tglAkhir, jenisDiet, tglLayanan);
response.setContentType("application/pdf"); response.setContentType("application/pdf");
JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream()); // Gunakan try-with-resources untuk memastikan OutputStream ditutup otomatis, mencegah kebocoran memori
}finally { try (OutputStream outputStream = response.getOutputStream()) {
// Ekspor PDF ke stream
JasperExportManager.exportReportToPdfStream(jasperPrint, outputStream);
// Panggil garbage collection secara eksplisit setelah pemrosesan untuk membantu mengelola memori (khususnya saat memproses gambar besar)
System.gc();
}
} finally {
jasperPrint = null; jasperPrint = null;
} }
} }
@ -359,8 +462,14 @@ public class ReportingController {
try { try {
jasperPrint = this.reportingService.printPdfRekapMakanan(idRu, tglAwal, tglAkhir); jasperPrint = this.reportingService.printPdfRekapMakanan(idRu, tglAwal, tglAkhir);
response.setContentType("application/pdf"); response.setContentType("application/pdf");
JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream()); // Gunakan try-with-resources untuk memastikan OutputStream ditutup otomatis, mencegah kebocoran memori
}finally { try (OutputStream outputStream = response.getOutputStream()) {
// Ekspor PDF ke stream
JasperExportManager.exportReportToPdfStream(jasperPrint, outputStream);
// Panggil garbage collection secara eksplisit setelah pemrosesan untuk membantu mengelola memori (khususnya saat memproses gambar besar)
System.gc();
}
} finally {
jasperPrint = null; jasperPrint = null;
} }
} }
@ -396,8 +505,14 @@ public class ReportingController {
try { try {
jasperPrint = this.reportingService.exportPdfSummaryList(nocm); jasperPrint = this.reportingService.exportPdfSummaryList(nocm);
response.setContentType("application/pdf"); response.setContentType("application/pdf");
JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream()); // Gunakan try-with-resources untuk memastikan OutputStream ditutup otomatis, mencegah kebocoran memori
}finally { try (OutputStream outputStream = response.getOutputStream()) {
// Ekspor PDF ke stream
JasperExportManager.exportReportToPdfStream(jasperPrint, outputStream);
// Panggil garbage collection secara eksplisit setelah pemrosesan untuk membantu mengelola memori (khususnya saat memproses gambar besar)
System.gc();
}
} finally {
jasperPrint = null; jasperPrint = null;
} }
} }
@ -411,8 +526,14 @@ public class ReportingController {
try { try {
jasperPrint = this.reportingService.printPdfAmprahanTindakan(idRu, tglAwal, tglAkhir); jasperPrint = this.reportingService.printPdfAmprahanTindakan(idRu, tglAwal, tglAkhir);
response.setContentType("application/pdf"); response.setContentType("application/pdf");
JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream()); // Gunakan try-with-resources untuk memastikan OutputStream ditutup otomatis, mencegah kebocoran memori
}finally { try (OutputStream outputStream = response.getOutputStream()) {
// Ekspor PDF ke stream
JasperExportManager.exportReportToPdfStream(jasperPrint, outputStream);
// Panggil garbage collection secara eksplisit setelah pemrosesan untuk membantu mengelola memori (khususnya saat memproses gambar besar)
System.gc();
}
} finally {
jasperPrint = null; jasperPrint = null;
} }
} }
@ -427,8 +548,14 @@ public class ReportingController {
try { try {
jasperPrint = this.reportingService.exportPdfKwitansi(noregistrasi, jeniskwitansi, nama_pt, kasir); jasperPrint = this.reportingService.exportPdfKwitansi(noregistrasi, jeniskwitansi, nama_pt, kasir);
response.setContentType("application/pdf"); response.setContentType("application/pdf");
JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream()); // Gunakan try-with-resources untuk memastikan OutputStream ditutup otomatis, mencegah kebocoran memori
}finally { try (OutputStream outputStream = response.getOutputStream()) {
// Ekspor PDF ke stream
JasperExportManager.exportReportToPdfStream(jasperPrint, outputStream);
// Panggil garbage collection secara eksplisit setelah pemrosesan untuk membantu mengelola memori (khususnya saat memproses gambar besar)
System.gc();
}
} finally {
jasperPrint = null; jasperPrint = null;
} }
} }
@ -440,8 +567,14 @@ public class ReportingController {
try { try {
jasperPrint = this.reportingService.exportPdfMonitoringUsulan(norec); jasperPrint = this.reportingService.exportPdfMonitoringUsulan(norec);
response.setContentType("application/pdf"); response.setContentType("application/pdf");
JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream()); // Gunakan try-with-resources untuk memastikan OutputStream ditutup otomatis, mencegah kebocoran memori
}finally { try (OutputStream outputStream = response.getOutputStream()) {
// Ekspor PDF ke stream
JasperExportManager.exportReportToPdfStream(jasperPrint, outputStream);
// Panggil garbage collection secara eksplisit setelah pemrosesan untuk membantu mengelola memori (khususnya saat memproses gambar besar)
System.gc();
}
} finally {
jasperPrint = null; jasperPrint = null;
} }
} }
@ -454,8 +587,14 @@ public class ReportingController {
try { try {
jasperPrint = this.reportingService.exportPdfSppb(norec, jnsbrg); jasperPrint = this.reportingService.exportPdfSppb(norec, jnsbrg);
response.setContentType("application/pdf"); response.setContentType("application/pdf");
JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream()); // Gunakan try-with-resources untuk memastikan OutputStream ditutup otomatis, mencegah kebocoran memori
}finally { try (OutputStream outputStream = response.getOutputStream()) {
// Ekspor PDF ke stream
JasperExportManager.exportReportToPdfStream(jasperPrint, outputStream);
// Panggil garbage collection secara eksplisit setelah pemrosesan untuk membantu mengelola memori (khususnya saat memproses gambar besar)
System.gc();
}
} finally {
jasperPrint = null; jasperPrint = null;
} }
} }
@ -468,8 +607,14 @@ public class ReportingController {
try { try {
jasperPrint = this.reportingService.exportPdfBuktiLayanan(norec, user); jasperPrint = this.reportingService.exportPdfBuktiLayanan(norec, user);
response.setContentType("application/pdf"); response.setContentType("application/pdf");
JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream()); // Gunakan try-with-resources untuk memastikan OutputStream ditutup otomatis, mencegah kebocoran memori
}finally { try (OutputStream outputStream = response.getOutputStream()) {
// Ekspor PDF ke stream
JasperExportManager.exportReportToPdfStream(jasperPrint, outputStream);
// Panggil garbage collection secara eksplisit setelah pemrosesan untuk membantu mengelola memori (khususnya saat memproses gambar besar)
System.gc();
}
} finally {
jasperPrint = null; jasperPrint = null;
} }
} }
@ -481,8 +626,14 @@ public class ReportingController {
try { try {
jasperPrint = this.reportingService.exportPdfBuktiNoLayanFarmasi(norec); jasperPrint = this.reportingService.exportPdfBuktiNoLayanFarmasi(norec);
response.setContentType("application/pdf"); response.setContentType("application/pdf");
JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream()); // Gunakan try-with-resources untuk memastikan OutputStream ditutup otomatis, mencegah kebocoran memori
}finally { try (OutputStream outputStream = response.getOutputStream()) {
// Ekspor PDF ke stream
JasperExportManager.exportReportToPdfStream(jasperPrint, outputStream);
// Panggil garbage collection secara eksplisit setelah pemrosesan untuk membantu mengelola memori (khususnya saat memproses gambar besar)
System.gc();
}
} finally {
jasperPrint = null; jasperPrint = null;
} }
} }
@ -494,12 +645,19 @@ public class ReportingController {
try { try {
jasperPrint = this.reportingService.exportPdfLabelFarmasi(norec); jasperPrint = this.reportingService.exportPdfLabelFarmasi(norec);
response.setContentType("application/pdf"); response.setContentType("application/pdf");
JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream()); // Gunakan try-with-resources untuk memastikan OutputStream ditutup otomatis, mencegah kebocoran memori
}finally { try (OutputStream outputStream = response.getOutputStream()) {
// Ekspor PDF ke stream
JasperExportManager.exportReportToPdfStream(jasperPrint, outputStream);
// Panggil garbage collection secara eksplisit setelah pemrosesan untuk membantu mengelola memori (khususnya saat memproses gambar besar)
System.gc();
}
} finally {
jasperPrint = null; jasperPrint = null;
} }
} }
@RequestMapping(value = {"/lap-tindakan"}, method = {RequestMethod.GET}) @RequestMapping(value = {"/lap-tindakan"}, method = {RequestMethod.GET})
public void exportPdfLaporanTindakan( public void exportPdfLaporanTindakan(
@RequestParam("ruanganid") Integer ruanganid, @RequestParam("ruanganid") Integer ruanganid,
@ -514,8 +672,14 @@ public class ReportingController {
try { try {
jasperPrint = this.reportingService.printPdfLaporanTindakan(ruanganid, instalasiid, kelasid, unitid, produkid, statusprodukid); jasperPrint = this.reportingService.printPdfLaporanTindakan(ruanganid, instalasiid, kelasid, unitid, produkid, statusprodukid);
response.setContentType("application/pdf"); response.setContentType("application/pdf");
JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream()); // Gunakan try-with-resources untuk memastikan OutputStream ditutup otomatis, mencegah kebocoran memori
}finally { try (OutputStream outputStream = response.getOutputStream()) {
// Ekspor PDF ke stream
JasperExportManager.exportReportToPdfStream(jasperPrint, outputStream);
// Panggil garbage collection secara eksplisit setelah pemrosesan untuk membantu mengelola memori (khususnya saat memproses gambar besar)
System.gc();
}
} finally {
jasperPrint = null; jasperPrint = null;
} }
} }
@ -526,8 +690,14 @@ public class ReportingController {
try { try {
jasperPrint = this.reportingService.exportPdfDKamar(); jasperPrint = this.reportingService.exportPdfDKamar();
response.setContentType("application/pdf"); response.setContentType("application/pdf");
JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream()); // Gunakan try-with-resources untuk memastikan OutputStream ditutup otomatis, mencegah kebocoran memori
}finally { try (OutputStream outputStream = response.getOutputStream()) {
// Ekspor PDF ke stream
JasperExportManager.exportReportToPdfStream(jasperPrint, outputStream);
// Panggil garbage collection secara eksplisit setelah pemrosesan untuk membantu mengelola memori (khususnya saat memproses gambar besar)
System.gc();
}
} finally {
jasperPrint = null; jasperPrint = null;
} }
} }
@ -539,8 +709,14 @@ public class ReportingController {
try { try {
jasperPrint = this.reportingService.exportPdfLabelFarmasiNo(norec); jasperPrint = this.reportingService.exportPdfLabelFarmasiNo(norec);
response.setContentType("application/pdf"); response.setContentType("application/pdf");
JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream()); // Gunakan try-with-resources untuk memastikan OutputStream ditutup otomatis, mencegah kebocoran memori
}finally { try (OutputStream outputStream = response.getOutputStream()) {
// Ekspor PDF ke stream
JasperExportManager.exportReportToPdfStream(jasperPrint, outputStream);
// Panggil garbage collection secara eksplisit setelah pemrosesan untuk membantu mengelola memori (khususnya saat memproses gambar besar)
System.gc();
}
} finally {
jasperPrint = null; jasperPrint = null;
} }
} }
@ -552,8 +728,14 @@ public class ReportingController {
try { try {
jasperPrint = this.reportingService.exportPdfUsulanPermintaanBdJ(norec); jasperPrint = this.reportingService.exportPdfUsulanPermintaanBdJ(norec);
response.setContentType("application/pdf"); response.setContentType("application/pdf");
JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream()); // Gunakan try-with-resources untuk memastikan OutputStream ditutup otomatis, mencegah kebocoran memori
}finally { try (OutputStream outputStream = response.getOutputStream()) {
// Ekspor PDF ke stream
JasperExportManager.exportReportToPdfStream(jasperPrint, outputStream);
// Panggil garbage collection secara eksplisit setelah pemrosesan untuk membantu mengelola memori (khususnya saat memproses gambar besar)
System.gc();
}
} finally {
jasperPrint = null; jasperPrint = null;
} }
} }
@ -683,7 +865,18 @@ public class ReportingController {
ModelAndView mv, HttpServletResponse response) throws Exception { ModelAndView mv, HttpServletResponse response) throws Exception {
JasperPrint jasperPrint = this.reportingService.exportPdfBuktiPengeluaranBarang(norec, idMenyerahkan, idMengetahui, idMenerima, jabatanMenyerahkan, jabatanMengetahui, jabatanMenerima, printBy); JasperPrint jasperPrint = this.reportingService.exportPdfBuktiPengeluaranBarang(norec, idMenyerahkan, idMengetahui, idMenerima, jabatanMenyerahkan, jabatanMengetahui, jabatanMenerima, printBy);
response.setContentType("application/pdf"); response.setContentType("application/pdf");
JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream()); // Gunakan try-with-resources untuk memastikan OutputStream ditutup otomatis, mencegah kebocoran memori
try (OutputStream outputStream = response.getOutputStream()) {
// Ekspor PDF ke stream
JasperExportManager.exportReportToPdfStream(jasperPrint, outputStream);
// Panggil garbage collection secara eksplisit setelah pemrosesan untuk membantu mengelola memori (khususnya saat memproses gambar besar)
// Catatan: Ini bukan jaminan, tetapi bisa mengurangi risiko OutOfMemoryError
System.gc();
} catch (Exception e) {
// Log error jika diperlukan (opsional, tambahkan logging sesuai kebutuhan aplikasi)
throw e; // Rethrow untuk menjaga perilaku asli
}
} }
@RequestMapping(value = {"/kartu-pasien-pulang/{noregistrasi}"}, method = {RequestMethod.GET}) @RequestMapping(value = {"/kartu-pasien-pulang/{noregistrasi}"}, method = {RequestMethod.GET})