feat(webstatement): update migrasi workflow and optimize period handling

- Menambahkan metode `index_manual` pada `MigrasiController` untuk pemrosesan manual.
- Mengganti implementasi metode `index` di `MigrasiController` agar secara otomatis menentukan dan memproses data dengan periode hari sebelumnya.
- Menambahkan validasi untuk memeriksa keberadaan folder periode pada storage SFTP sebelum melakukan pemrosesan.
- Menyesuaikan logika pemanggilan fungsi-fungsi pemrosesan data sesuai urutan:
  - `ProcessCategoryData`
  - `ProcessCompanyData`
  - `processCustomerData`
  - `processAccountData`
  - `processStmtEntryData`
  - `ProcessDataCaptureData`
  - `processFundsTransferData`
  - `ProcessTellerData`
  - `ProcessAtmTransaction`
  - `processArrangementData`
  - `processBillDetailData`
- Memodifikasi daftar periode pada metode `listPeriod` di `WebstatementController` untuk secara dinamis mengambil periode hari sebelumnya menggunakan `date('Ymd', strtotime('-1 day'))`.
- Menghapus elemen hardcoded pada daftar periode untuk efisiensi kustomisasi.

Signed-off-by: Daeng Deni Mardaeni <ddeni05@gmail.com>
This commit is contained in:
Daeng Deni Mardaeni
2025-05-24 13:54:49 +07:00
parent 566dd1e4e7
commit d1962113ed
2 changed files with 38 additions and 12 deletions

View File

@@ -173,7 +173,7 @@ class MigrasiController extends Controller
}
public function index()
public function index_manual()
{
//$disk = Storage::disk('sftpStatement');
@@ -231,6 +231,42 @@ class MigrasiController extends Controller
$this->processBillDetailData([$period]);
}
return response()->json(['message' => 'Data processing job has been successfully']);
}
/**
* Process data migration for the previous day's period.
*
* This method automatically determines the period based on yesterday's date,
* checks if the corresponding folder exists in SFTP storage, and then
* processes all required data types in the correct sequence.
*
* @return \Illuminate\Http\JsonResponse A JSON response indicating success or failure
* @throws \Exception If the period folder doesn't exist or if any processing job fails
*/
public function index(){
$disk = Storage::disk('sftpStatement');
$period = date('Ymd', strtotime('-1 day'));
if (!$disk->exists($period)) {
return response()->json(['message' => 'Period folder not found in SFTP storage'], 404);
}
$this->ProcessCategoryData([$period]);
$this->ProcessCompanyData([$period]);
$this->processCustomerData([$period]);
$this->processAccountData([$period]);
$this->processStmtEntryData([$period]);
$this->ProcessDataCaptureData([$period]);
$this->processFundsTransferData([$period]);
$this->ProcessTellerData([$period]);
$this->ProcessAtmTransaction([$period]);
$this->processArrangementData([$period]);
$this->processBillDetailData([$period]);
return response()->json(['message' => 'Data processing job has been successfully']);
}
}

View File

@@ -111,17 +111,7 @@
function listPeriod(){
return [
'20250512',
'20250513',
'20250514',
'20250515',
'20250516',
'20250517',
'20250518',
'20250519',
'20250520',
'20250521',
'20250522'
date('Ymd', strtotime('-1 day'))
];
}