Update file path

Penerapan directory path file jasper xml, pdf sep, dan pdf lis untuk migrasi server
This commit is contained in:
Salman Manoe 2023-07-13 11:51:15 +07:00
parent 439eb26c34
commit 9b8f74c9bf
5 changed files with 45 additions and 23 deletions

View File

@ -7,6 +7,7 @@ import com.reporting.service.VerifikasiTagihanSupplierServices;
import net.sf.jasperreports.engine.JasperExportManager;
import net.sf.jasperreports.engine.JasperPrint;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
@ -30,6 +31,12 @@ public class ReportingController {
@Autowired
private VerifikasiTagihanSupplierServices verifikasiTagihanSupplierServices;
@Value("${application.pdf.dir-sep}")
String sepDirPath;
@Value("${application.pdf.dir-lis}")
String lisDirPath;
public ReportingController() {
}
@ -108,7 +115,7 @@ public class ReportingController {
@RequestMapping(value = {"/lap-lab/{noorder}"}, method = {RequestMethod.GET})
public void showPDF(@PathVariable("noorder") String noorder, HttpServletResponse response) {
try (InputStream inputStream = Files.newInputStream(
new File("/mnt/lis/" + noorder + ".pdf").toPath())) {
new File(lisDirPath + noorder + ".pdf").toPath())) {
int nRead;
while ((nRead = inputStream.read()) != -1) {
response.getWriter().write(nRead);
@ -121,7 +128,7 @@ public class ReportingController {
@RequestMapping(value = {"/cetak-sep/{norec_pd}"}, method = {RequestMethod.GET})
public void showPDFSEP(@PathVariable("norec_pd") String norec_pd, HttpServletResponse response) {
try (InputStream inputStream = Files.newInputStream(
new File("/home/admindev/reporting/" + norec_pd + ".pdf").toPath())) {
new File(sepDirPath + norec_pd + ".pdf").toPath())) {
int nRead;
while ((nRead = inputStream.read()) != -1) {
response.getWriter().write(nRead);

View File

@ -9,6 +9,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
@ -32,6 +33,9 @@ public class ReportingDao {
@Autowired
private JdbcTemplate jdbcTemplate1;
@Value("${application.jasper-xml.dir-path}")
String jasperDirPath;
public ReportingDao() {
}
@ -70,7 +74,7 @@ public class ReportingDao {
public JasperPrint exportPdfLabelGizi(String noregistrasi) {
try (Connection conn = this.jdbcTemplate1.getDataSource().getConnection()) {
String path = "/usr/share/app/reporting/rpt_labelgizi.jrxml";
String path = jasperDirPath + "rpt_labelgizi.jrxml";
JasperReport jasperReport = JasperCompileManager.compileReport(path);
Map<String, Object> parameters = new HashMap<>();
parameters.put("noregistrasi", noregistrasi);
@ -84,7 +88,7 @@ public class ReportingDao {
public JasperPrint exportPdfPermintaanMakanan(Integer idRu, String tglAwal, String tglAkhir) {
try (Connection conn = this.jdbcTemplate1.getDataSource().getConnection()) {
String path = "/usr/share/app/reporting/pl_permintaan_makan.jrxml";
String path = jasperDirPath + "pl_permintaan_makan.jrxml";
JasperReport jasperReport = JasperCompileManager.compileReport(path);
Map<String, Object> parameters = new HashMap<>();
parameters.put("idRu", idRu);
@ -100,7 +104,7 @@ public class ReportingDao {
public JasperPrint exportPdfRekapMakanan(Integer idRu, String tglAwal, String tglAkhir) {
try (Connection conn = this.jdbcTemplate1.getDataSource().getConnection()) {
String path = "/usr/share/app/reporting/pl_rekap_makan.jrxml";
String path = jasperDirPath + "pl_rekap_makan.jrxml";
JasperReport jasperReport = JasperCompileManager.compileReport(path);
Map<String, Object> parameters = new HashMap<>();
parameters.put("idRu", idRu);
@ -116,7 +120,7 @@ public class ReportingDao {
public JasperPrint exportPdfKartuPasien(String nocm) {
try (Connection conn = this.jdbcTemplate1.getDataSource().getConnection()) {
String path = "/usr/share/app/reporting/rpt_kartupasien.jrxml";
String path = jasperDirPath + "rpt_kartupasien.jrxml";
JasperReport jasperReport = JasperCompileManager.compileReport(path);
Map<String, Object> parameters = new HashMap<>();
parameters.put("nocm", nocm);
@ -130,7 +134,7 @@ public class ReportingDao {
public JasperPrint exportPdfLapBedah(String noregis) {
try (Connection conn = this.jdbcTemplate1.getDataSource().getConnection()) {
String path = "/usr/share/app/reporting/rpt_lapbedah.jrxml";
String path = jasperDirPath + "rpt_lapbedah.jrxml";
JasperReport jasperReport = JasperCompileManager.compileReport(path);
Map<String, Object> parameters = new HashMap<>();
parameters.put("noregis", noregis);
@ -144,7 +148,7 @@ public class ReportingDao {
public JasperPrint exportPdfKonsul(String noorder) {
try (Connection conn = this.jdbcTemplate1.getDataSource().getConnection()) {
String path = "/usr/share/app/reporting/rpt_konsul.jrxml";
String path = jasperDirPath + "rpt_konsul.jrxml";
JasperReport jasperReport = JasperCompileManager.compileReport(path);
Map<String, Object> parameters = new HashMap<>();
parameters.put("noorder", noorder);
@ -158,7 +162,7 @@ public class ReportingDao {
public JasperPrint exportPdfUpk(String nores) {
try (Connection conn = this.jdbcTemplate1.getDataSource().getConnection()) {
String path = "/usr/share/app/reporting/rpt_upk.jrxml";
String path = jasperDirPath + "rpt_upk.jrxml";
JasperReport jasperReport = JasperCompileManager.compileReport(path);
Map<String, Object> parameters = new HashMap<>();
parameters.put("nores", nores);
@ -172,7 +176,7 @@ public class ReportingDao {
public JasperPrint exportPdfVerifikasiTagihan(String noverifikasifk) {
try (Connection conn = this.jdbcTemplate1.getDataSource().getConnection()) {
String path = "/usr/share/app/reporting/BuktiKas.jrxml";
String path = jasperDirPath + "BuktiKas.jrxml";
JasperReport jasperReport = JasperCompileManager.compileReport(path);
Map<String, Object> parameters = new HashMap<>();
parameters.put("noverifikasifk", noverifikasifk);
@ -186,7 +190,7 @@ public class ReportingDao {
public JasperPrint exportPdfLapRekapHarianByDept(int deptId, String tglAwal, String tglAkhir) {
try (Connection conn = this.jdbcTemplate1.getDataSource().getConnection()) {
String path = "/usr/share/app/reporting/PL_LapRekapPHarian.jrxml";
String path = jasperDirPath + "PL_LapRekapPHarian.jrxml";
JasperReport jasperReport = JasperCompileManager.compileReport(path);
Map<String, Object> parameters = new HashMap<>();
parameters.put("deptId", deptId);
@ -202,7 +206,7 @@ public class ReportingDao {
public JasperPrint exportPdfLapRekapHarianByRuanganId(int deptId, int ruangId, String tglAwal, String tglAkhir) {
try (Connection conn = this.jdbcTemplate1.getDataSource().getConnection()) {
String path = "/usr/share/app/reporting/PL_LapRekapPHarianV2.jrxml";
String path = jasperDirPath + "PL_LapRekapPHarianV2.jrxml";
JasperReport jasperReport = JasperCompileManager.compileReport(path);
Map<String, Object> parameters = new HashMap<>();
parameters.put("deptId", deptId);
@ -219,7 +223,7 @@ public class ReportingDao {
public JasperPrint exportPdfPengkajianAwalByNoRes(String nores) {
try (Connection conn = this.jdbcTemplate1.getDataSource().getConnection()) {
String path = "/usr/share/app/reporting/PL_PengkajianAwal.jrxml";
String path = jasperDirPath + "PL_PengkajianAwal.jrxml";
JasperReport jasperReport = JasperCompileManager.compileReport(path);
Map<String, Object> parameters = new HashMap<>();
parameters.put("nores", nores);
@ -233,7 +237,7 @@ public class ReportingDao {
public JasperPrint exportPdfRekapPenjamin(String tglAwal, String tglAkhir, int idDept, int kelompokPasien) {
try (Connection conn = this.jdbcTemplate1.getDataSource().getConnection()) {
String path = "/usr/share/app/reporting/PL_rekap_penjamin.jrxml";
String path = jasperDirPath + "PL_rekap_penjamin.jrxml";
JasperReport jasperReport = JasperCompileManager.compileReport(path);
Map<String, Object> parameters = new HashMap<>();
parameters.put("tglAwal", tglAwal);
@ -251,7 +255,7 @@ public class ReportingDao {
public JasperPrint exportPdfRekapPenjaminByInstitusiPasien(
String tglAwal, String tglAkhir, int idDept, int kelompokPasien, int institusiPasien) {
try (Connection conn = this.jdbcTemplate1.getDataSource().getConnection()) {
String path = "/usr/share/app/reporting/PL_rekap_penjamin.jrxml";
String path = jasperDirPath + "PL_rekap_penjamin.jrxml";
JasperReport jasperReport = JasperCompileManager.compileReport(path);
Map<String, Object> parameters = new HashMap<>();
parameters.put("tglAwal", tglAwal);
@ -269,7 +273,7 @@ public class ReportingDao {
public JasperPrint exportPdfRekapPenjaminByRanap(String tglAwal, String tglAkhir, int idDept, int kelompokPasien) {
try (Connection conn = this.jdbcTemplate1.getDataSource().getConnection()) {
String path = "/usr/share/app/reporting/PL_rekap_penjaminRanap.jrxml";
String path = jasperDirPath + "PL_rekap_penjaminRanap.jrxml";
JasperReport jasperReport = JasperCompileManager.compileReport(path);
Map<String, Object> parameters = new HashMap<>();
parameters.put("tglAwal", tglAwal);
@ -286,7 +290,7 @@ public class ReportingDao {
public JasperPrint exportPdfPermintaanMakanan(int idRu, String tglAwal, String tglAkhir) {
try (Connection conn = this.jdbcTemplate1.getDataSource().getConnection()) {
String path = "/usr/share/app/reporting/pl_permintaan_makan.jrxml";
String path = jasperDirPath + "pl_permintaan_makan.jrxml";
JasperReport jasperReport = JasperCompileManager.compileReport(path);
Map<String, Object> parameters = new HashMap<>();
parameters.put("idRu", idRu);
@ -302,7 +306,7 @@ public class ReportingDao {
public JasperPrint exportPdfRekapMakanan(int idRu, String tglAwal, String tglAkhir) {
try (Connection conn = this.jdbcTemplate1.getDataSource().getConnection()) {
String path = "/usr/share/app/reporting/pl_rekap_makan.jrxml";
String path = jasperDirPath + "pl_rekap_makan.jrxml";
JasperReport jasperReport = JasperCompileManager.compileReport(path);
Map<String, Object> parameters = new HashMap<>();
parameters.put("idRu", idRu);
@ -318,7 +322,7 @@ public class ReportingDao {
public JasperPrint exportPdfGelangPasien(String noregistrasi) {
try (Connection conn = this.jdbcTemplate1.getDataSource().getConnection()) {
String path = "/usr/share/app/reporting/gelang_pasien.jrxml";
String path = jasperDirPath + "gelang_pasien.jrxml";
JasperReport jasperReport = JasperCompileManager.compileReport(path);
Map<String, Object> parameters = new HashMap<>();
parameters.put("noregistrasi", noregistrasi);
@ -332,7 +336,7 @@ public class ReportingDao {
public JasperPrint exportPdfResumeMedis(String norec) {
try (Connection conn = this.jdbcTemplate1.getDataSource().getConnection()) {
String path = "/usr/share/app/reporting/ResumeMedis.jrxml";
String path = jasperDirPath + "ResumeMedis.jrxml";
JasperReport jasperReport = JasperCompileManager.compileReport(path);
Map<String, Object> parameters = new HashMap<>();
parameters.put("norec", norec);

View File

@ -14,6 +14,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
@ -38,6 +39,9 @@ public class ResepService {
@Autowired
private JdbcTemplate jdbcTemplate1;
@Value("${application.jasper-xml.dir-path}")
String jasperDirPath;
public ResepService() {
}
@ -141,7 +145,7 @@ public class ResepService {
public JasperPrint exportPdfResepPasien(String strukOrder) {
try (Connection conn = this.jdbcTemplate1.getDataSource().getConnection()) {
String path = "/usr/share/app/reporting/rpt_eresep1.jrxml";
String path = jasperDirPath + "rpt_eresep1.jrxml";
JasperReport jasperReport = JasperCompileManager.compileReport(path);
String namaPasien = this.getPasien(strukOrder).getNamaPasien();
String noRegistrasi = this.getPasien(strukOrder).getNoRegistrasi();

View File

@ -11,6 +11,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
@ -36,6 +37,9 @@ public class VerifikasiTagihanSupplierServices {
@Autowired
private JdbcTemplate jdbcTemplate1;
@Value("${application.jasper-xml.dir-path}")
String jasperDirPath;
public VerifikasiTagihanSupplierServices() {
}
@ -364,7 +368,7 @@ public class VerifikasiTagihanSupplierServices {
Map<String, Object> parameters = new HashMap<>();
parameters.put("noverifikasifk", noverifikasifk);
JRBeanCollectionDataSource jrbcds = new JRBeanCollectionDataSource(collection);
String path = "/usr/share/app/reporting/rpt_verifikasitagihansupplier.jrxml";
String path = jasperDirPath + "rpt_verifikasitagihansupplier.jrxml";
JasperReport jasperReport = JasperCompileManager.compileReport(path);
return JasperFillManager.fillReport(jasperReport, parameters, jrbcds);
} catch (Exception var13) {
@ -412,7 +416,7 @@ public class VerifikasiTagihanSupplierServices {
Map<String, Object> parameters = new HashMap<>();
parameters.put("noverifikasifk", noverifikasifk);
JRBeanCollectionDataSource jrbcds = new JRBeanCollectionDataSource(collection);
String path = "/usr/share/app/reporting/rpt_verifikasipembayaranumum.jrxml";
String path = jasperDirPath + "rpt_verifikasipembayaranumum.jrxml";
JasperReport jasperReport = JasperCompileManager.compileReport(path);
return JasperFillManager.fillReport(jasperReport, parameters, jrbcds);
} catch (Exception var13) {

View File

@ -6,3 +6,6 @@ spring.datasource.username=postgres
spring.datasource.password=root
spring.mvc.dispatch-trace-request=true
spring.main.banner-mode=off
application.jasper-xml.dir-path=/mnt/files/jasper-xml/
application.pdf.dir-sep=/mnt/files/sep/
application.pdf.dir-lis=/mnt/lis/