update buktipengeluaranbarang
This commit is contained in:
parent
d4d9ef1ce8
commit
1395da9441
@ -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);
|
||||
JasperPrint jasperPrint = null;
|
||||
try {
|
||||
jasperPrint = this.reportingService.exportPdfdaftarPenerimaBarangFarmasi(norec, idMenyerahkan, idMengetahui, idMenerima, jabatanMenyerahkan, jabatanMengetahui, jabatanMenerima, printBy);
|
||||
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 {
|
||||
jasperPrint = null;
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/bukti-pengeluaran-barang/{norec}"}, method = {RequestMethod.GET})
|
||||
@ -863,7 +875,9 @@ 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);
|
||||
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()) {
|
||||
@ -871,11 +885,10 @@ public class ReportingController {
|
||||
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
|
||||
}
|
||||
} finally {
|
||||
jasperPrint = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user