update buktipengeluaranbarang

This commit is contained in:
ridwan 2025-12-03 13:38:32 +07:00
parent d4d9ef1ce8
commit 1395da9441

View File

@ -820,7 +820,7 @@ public class ReportingController {
jasperPrint = this.reportingService.exportPdfKwitansiCollectingPiutang(norec, PrintBy);
response.setContentType("application/pdf");
JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream());
}finally {
} finally {
jasperPrint = null;
}
}
@ -848,9 +848,21 @@ public class ReportingController {
@RequestParam(value = "jabatanMenerima", required = false, defaultValue = "") String jabatanMenerima,
@RequestParam(value = "printBy", required = false, defaultValue = "") String printBy,
ModelAndView mv, HttpServletResponse response) throws Exception {
JasperPrint jasperPrint = this.reportingService.exportPdfdaftarPenerimaBarangFarmasi(norec, idMenyerahkan, idMengetahui, idMenerima, jabatanMenyerahkan, jabatanMengetahui, jabatanMenerima, printBy);
response.setContentType("application/pdf");
JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream());
JasperPrint jasperPrint = null;
try {
jasperPrint = this.reportingService.exportPdfdaftarPenerimaBarangFarmasi(norec, idMenyerahkan, idMengetahui, idMenerima, jabatanMenyerahkan, jabatanMengetahui, jabatanMenerima, printBy);
response.setContentType("application/pdf");
// 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 {
jasperPrint = null;
}
}
@RequestMapping(value = {"/bukti-pengeluaran-barang/{norec}"}, method = {RequestMethod.GET})
@ -863,19 +875,20 @@ public class ReportingController {
@RequestParam(value = "jabatanMenerima", required = false, defaultValue = "") String jabatanMenerima,
@RequestParam(value = "printBy", required = false, defaultValue = "") String printBy,
ModelAndView mv, HttpServletResponse response) throws Exception {
JasperPrint jasperPrint = this.reportingService.exportPdfBuktiPengeluaranBarang(norec, idMenyerahkan, idMengetahui, idMenerima, jabatanMenyerahkan, jabatanMengetahui, jabatanMenerima, printBy);
response.setContentType("application/pdf");
// 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);
JasperPrint jasperPrint = null;
try {
jasperPrint = this.reportingService.exportPdfBuktiPengeluaranBarang(norec, idMenyerahkan, idMengetahui, idMenerima, jabatanMenyerahkan, jabatanMengetahui, jabatanMenerima, printBy);
response.setContentType("application/pdf");
// 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
// Panggil garbage collection secara eksplisit setelah pemrosesan untuk membantu mengelola memori (khususnya saat memproses gambar besar)
System.gc();
}
} finally {
jasperPrint = null;
}
}