Update ShippingInvoiceController.java

cleanup convertToPdf function not deleted during merge
pull/6221/head
Gauthier LO 2024-01-05 09:41:57 +01:00 committed by GitHub
parent daecbead81
commit bbbf298825
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 0 additions and 25 deletions

View File

@ -314,31 +314,6 @@ public class ShippingInvoiceController {
}
}
public String convertToPdf(String invoiceNumber, String fileType) throws Exception {
String excelFilePath = shippingInvoiceService.getInvoiceList(invoiceNumber, fileType);// (C:\PATH\filename.xlsx)
if(!excelFilePath.equals("ERROR")) {
String pdfFilePath= INVOICE_PDF_LOCATION + "/" + invoiceNumber + ".pdf";
if(fileType.equals("invoice")){
pdfFilePath = INVOICE_PDF_LOCATION + "/Invoice N°" + invoiceNumber + ".pdf";
}
if(fileType.equals("detail")) {
pdfFilePath = INVOICE_DETAIL_PDF_LOCAION + "/Détail_calcul_de_facture_" + invoiceNumber + ".pdf";
}
Pattern p = Pattern.compile("^(.*)[\\/\\\\](.*)(\\.[a-z]+)"); //group(1): "C:\PATH" , group(2) : "filename", group(3): ".xlsx"
Matcher m = p.matcher(excelFilePath);
if (m.matches()) {
pdfFilePath = INVOICE_PDF_LOCATION + "/" + m.group(2) + ".pdf";
}
// Créé un classeur pour charger le fichier Excel
Workbook workbook = new Workbook(excelFilePath);
// On enregistre le document au format PDF
workbook.save(pdfFilePath, SaveFormat.PDF);
return pdfFilePath;
}
return "ERROR";
}
/**
*
* @param invoiceNumber