Update service reporting
Pembuatan endpoint API untuk cetakan kwitansi di SMART
This commit is contained in:
parent
19c485f717
commit
2b062bff69
@ -298,4 +298,12 @@ public class ReportingController {
|
||||
response.setContentType("application/pdf");
|
||||
JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream());
|
||||
}
|
||||
|
||||
@RequestMapping(value = {"/kwitansi/{noSbm}"}, method = {RequestMethod.GET})
|
||||
public void exportKwitansi(@PathVariable("noSbm") String noSbm,
|
||||
ModelAndView mv, HttpServletResponse response) throws Exception {
|
||||
JasperPrint jasperPrint = this.reportingService.exportPdfKwitansi(noSbm);
|
||||
response.setContentType("application/pdf");
|
||||
JasperExportManager.exportReportToPdfStream(jasperPrint, response.getOutputStream());
|
||||
}
|
||||
}
|
||||
|
||||
@ -393,4 +393,18 @@ public class ReportingDao {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public JasperPrint exportPdfKwitansi(String noSbm) {
|
||||
try (Connection conn = this.jdbcTemplate1.getDataSource().getConnection()) {
|
||||
String path = jasperDirPath + "kwitansi.jrxml";
|
||||
JasperReport jasperReport = JasperCompileManager.compileReport(path);
|
||||
Map<String, Object> parameters = new HashMap<>();
|
||||
parameters.put("nosbm", noSbm);
|
||||
return JasperFillManager.fillReport(jasperReport, parameters, conn);
|
||||
} catch (Exception var17) {
|
||||
LOG.error("Exception at exportPdfKwitansi");
|
||||
LOG.error(ReportingDao.class, var17);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -119,4 +119,8 @@ public class ReportingService {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public JasperPrint exportPdfKwitansi(String noSbm) {
|
||||
return this.reportingDao.exportPdfKwitansi(noSbm);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user