feat(webstatement): tambahkan pengaturan tujuan output dan unggah ke SFTP untuk combine PDF
- Memperbarui `CombinePdfJob`:
- Menambahkan parameter baru `outputDestination`, `branchCode`, dan `period` pada constructor untuk pengaturan tujuan output.
- Menambahkan opsi tujuan output ke `local` atau `sftp` pada proses combine PDF.
- Menambahkan metode baru `uploadToSftp` untuk mengunggah file PDF hasil gabungan ke SFTP.
- Mengatur jalur unggahan SFTP ke `combine/{period}/{branchCode}/{filename}`.
- Menambahkan log informasi terkait jalur dan status unggahan file PDF ke SFTP.
- Memperbarui `CombinePdfController`:
- Menambahkan konfigurasi `output_destination` untuk menentukan tujuan output (`local` atau `sftp`).
- Memperbarui pemanggilan `CombinePdfJob::dispatch` dengan parameter baru untuk konfigurasi output dan SFTP.
- Menyesuaikan log dan respons untuk mencerminkan tujuan output yang disetel.
- Tujuan pembaruan ini:
- Memungkinkan pengaturan flexibel tujuan penyimpanan file PDF ke lokal atau SFTP.
- Menyediakan log yang lebih informatif terkait proses combine PDF dan unggahan SFTP.
- Mempermudah integrasi dan pengelolaan file PDF dengan pengaturan jalur dan periodisasi yang jelas.
Signed-off-by: Daeng Deni Mardaeni <ddeni05@gmail.com>
This commit is contained in:
@@ -32,6 +32,9 @@ class CombinePdfController extends Controller
|
||||
// Configuration: Set r23 file source - 'local' or 'sftp'
|
||||
$file_r23 = 'local'; // Change this to 'sftp' to use SFTP for r23 files
|
||||
|
||||
// Configuration: Set output destination - 'local' or 'sftp'
|
||||
$output_destination = 'local'; // Change this to 'sftp' to upload combined PDFs to SFTP
|
||||
|
||||
// Get period from request or use current period
|
||||
$period = $period ?? date('Ym');
|
||||
|
||||
@@ -112,10 +115,10 @@ class CombinePdfController extends Controller
|
||||
$password = $this->generatePassword($account);
|
||||
|
||||
// Dispatch job to combine PDFs or apply password protection
|
||||
CombinePdfJob::dispatch($pdfFiles, $outputDir, $outputFilename, $password);
|
||||
CombinePdfJob::dispatch($pdfFiles, $outputDir, $outputFilename, $password, $output_destination, $branchCode, $period);
|
||||
$processedCount++;
|
||||
|
||||
Log::info("Queued PDF processing for account {$accountNumber} - r14: local, r23: {$file_r23}, password: {$password}");
|
||||
Log::info("Queued PDF processing for account {$accountNumber} - r14: local, r23: {$file_r23}, output: {$output_destination}, password: {$password}");
|
||||
} catch (\Exception $e) {
|
||||
Log::error("Error processing PDF for account {$accountNumber}: {$e->getMessage()}");
|
||||
$errorCount++;
|
||||
@@ -123,7 +126,7 @@ class CombinePdfController extends Controller
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'message' => "PDF combination process has been queued (r14: local, r23: {$file_r23})",
|
||||
'message' => "PDF combination process has been queued (r14: local, r23: {$file_r23}, output: {$output_destination})",
|
||||
'processed' => $processedCount,
|
||||
'skipped' => $skippedCount,
|
||||
'errors' => $errorCount,
|
||||
|
||||
Reference in New Issue
Block a user